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.
This commit is contained in:
ZhenYi 2026-04-16 22:23:17 +08:00
parent 8a0d2885f7
commit d26e947f8e

View File

@ -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();