MCPcopy Create free account
hub / github.com/RightNow-AI/rightnow-cli / test_concurrent_database_access

Method test_concurrent_database_access

tests/test_cache.py:431–448  ·  view source on GitHub ↗

Test concurrent database access.

(self, cache_manager, sample_kernel)

Source from the content-addressed store, hash-verified

429 # This test ensures no unhandled exception
430
431 def test_concurrent_database_access(self, cache_manager, sample_kernel):
432 """Test concurrent database access."""
433 import threading
434
435 def cache_kernel(model_num):
436 cache_manager.cache_kernel(f"model{model_num}", "op", sample_kernel)
437
438 threads = []
439 for i in range(5):
440 t = threading.Thread(target=cache_kernel, args=(i,))
441 threads.append(t)
442 t.start()
443
444 for t in threads:
445 t.join()
446
447 # All kernels should be cached
448 assert cache_manager.count_cached_kernels() == 5

Callers

nothing calls this directly

Calls 2

count_cached_kernelsMethod · 0.80
startMethod · 0.45

Tested by

no test coverage detected