From 60219b20754dda7f560deb5e9e442d46e4636507 Mon Sep 17 00:00:00 2001 From: 魏曹先生 <1992414357@qq.com> Date: Mon, 27 Oct 2025 17:50:35 +0800 Subject: update: Add server lock behavior to vault lifecycle Lock the vault before starting the server and unlock it during shutdown. --- crates/vcs_actions/src/connection/action_service.rs | 9 +++++++++ 1 file changed, 9 insertions(+) (limited to 'crates') diff --git a/crates/vcs_actions/src/connection/action_service.rs b/crates/vcs_actions/src/connection/action_service.rs index f76921e..a657408 100644 --- a/crates/vcs_actions/src/connection/action_service.rs +++ b/crates/vcs_actions/src/connection/action_service.rs @@ -31,6 +31,12 @@ pub async fn server_entry(vault_path: impl Into) -> Result<(), TcpTarge // Initialize the vault let vault: Arc = init_vault(vault_cfg, vault_path.into()).await?; + // Lock the vault + vault.lock().map_err(|e| { + error!("{}", e); + TcpTargetError::Locked(e.to_string()) + })?; + // Create ActionPool let action_pool: Arc = Arc::new(server_action_pool()); @@ -38,6 +44,9 @@ pub async fn server_entry(vault_path: impl Into) -> Result<(), TcpTarge let (_shutdown_rx, future) = build_server_future(vault.clone(), action_pool.clone(), listener); future.await?; // Start and block until shutdown + // Unlock the vault + vault.unlock()?; + Ok(()) } -- cgit