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:
parent
8a0d2885f7
commit
d26e947f8e
@ -259,6 +259,13 @@ impl GitHookPool {
|
|||||||
.map_err(crate::GitError::from)?
|
.map_err(crate::GitError::from)?
|
||||||
.ok_or_else(|| crate::GitError::NotFound(format!("repo {} not found", repo_id)))?;
|
.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 db_clone = self.db.clone();
|
||||||
let cache_clone = self.cache.clone();
|
let cache_clone = self.cache.clone();
|
||||||
let repo_clone = repo.clone();
|
let repo_clone = repo.clone();
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user