Self-evolving Context Database for AI Agents. Unify Agent Memory, Knowledge RAG and Skills.
Python agent-contextagent-memoryagent-pluginsagentic-ragcontext-databasedsh-pluginknowledge-basememorymemory-managementself-evolvingvector-database
Fix dual path lock (#3454)
baojun-zhang2b78fff498ed
diff --git a/openviking/storage/transaction/path_lock.py b/openviking/storage/transaction/path_lock.pyindex 693c51935..7b80c8dfb 100644--- a/openviking/storage/transaction/path_lock.py+++ b/openviking/storage/transaction/path_lock.py@@ -27,7 +27,7 @@ LOCK_TYPE_TREE = "T"_READ_ONLY_TREE_LOCK_TYPES = {"P", "S"}# Default poll interval when waiting for a lock (seconds)-_POLL_INTERVAL = 0.2+_POLL_INTERVAL = 0.1_WAIT_LOG_INTERVAL = 10.0_last_timeout_warning_at: dict[str, float] = {}diff --git a/openviking/storage/viking_fs.py b/openviking/storage/viking_fs.pyindex cbc1a1938..939695624 100644--- a/openviking/storage/viking_fs.py+++ b/openviking/storage/viking_fs.py@@ -382,6 +382,14 @@ class VikingFS:get_lock_manager(),self._encrypted_write_lock_paths(path),lock_mode="exact",+ # Encrypted writes lock both the final path and the deterministic+ # staging path under `.encrypt_stage`. Keeping the global default+ # timeout at 0 is still desirable for ordinary path locks, but+ # this specific dual-path write is much more exposed to short-lived+ # contention between concurrent writers. A small 1-second wait here+ # lets us ride out transient conflicts without broadening lock+ # behavior for unrelated call sites.+ timeout=1.0,handle=lock_handle,):return await operation()@@ -4054,9 +4062,7 @@ class VikingFS:real_ctx = self._ctx_or_default(ctx)account = real_ctx.account_idtree_paths = (- None- if not paths- else [self._uri_to_tree_path(path, ctx=real_ctx) for path in paths]+ None if not paths else [self._uri_to_tree_path(path, ctx=real_ctx) for path in paths])return await self._async_agfs.run("git_log",diff --git a/tests/storage/test_viking_fs_write_locking.py b/tests/storage/test_viking_fs_write_locking.pyindex ae8abe2f6..6765cb9ed 100644--- a/tests/storage/test_viking_fs_write_locking.py+++ b/tests/storage/test_viking_fs_write_locking.py@@ -78,7 +78,7 @@ async def test_encrypted_writes_lock_final_and_temp_paths("/local/default/temp/.encrypt_stage/571a25aab6e6bca05a60a6e4aec646389a9ac38237daf55ceda4f72f3d1b4afe.encrypt",],"exact",- {"handle": None},+ {"timeout": 1.0, "handle": None},)]assert agfs.storage["/local/default/resources/note.md"] == expected_bytes