From d26e947f8e5c6d7fa4033ce2d205301f9358b585 Mon Sep 17 00:00:00 2001 From: ZhenYi <434836402@qq.com> Date: Thu, 16 Apr 2026 22:23:17 +0800 Subject: [PATCH] fix(git): add storage_path existence pre-check in run_sync Fail fast if repo storage_path does not exist on disk, before blocking the thread pool with spawn_blocking. This prevents invalid tasks from consuming blocking threads while failing. --- libs/git/hook/pool/mod.rs | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/libs/git/hook/pool/mod.rs b/libs/git/hook/pool/mod.rs index cd4af93..cb520fa 100644 --- a/libs/git/hook/pool/mod.rs +++ b/libs/git/hook/pool/mod.rs @@ -259,6 +259,13 @@ impl GitHookPool { .map_err(crate::GitError::from)? .ok_or_else(|| crate::GitError::NotFound(format!("repo {} not found", repo_id)))?; + // Fail fast if storage path doesn't exist — avoid blocking spawn_blocking thread pool. + if !std::path::Path::new(&repo.storage_path).exists() { + return Err(crate::GitError::NotFound(format!( + "storage path does not exist: {}", repo.storage_path + ))); + } + let db_clone = self.db.clone(); let cache_clone = self.cache.clone(); let repo_clone = repo.clone();