fix(git): add storage_path existence pre-check to run_fsck and run_gc
Consistent with run_sync: fail fast before blocking the thread pool if the repo storage path does not exist on disk.
This commit is contained in:
parent
d26e947f8e
commit
329b526bfb
@ -439,6 +439,12 @@ impl GitHookPool {
|
||||
.map_err(crate::GitError::from)?
|
||||
.ok_or_else(|| crate::GitError::NotFound(format!("repo {} not found", repo_id)))?;
|
||||
|
||||
if !std::path::Path::new(&repo.storage_path).exists() {
|
||||
return Err(crate::GitError::NotFound(format!(
|
||||
"storage path does not exist: {}", repo.storage_path
|
||||
)));
|
||||
}
|
||||
|
||||
self.log_stream
|
||||
.info(&task.id, &task.repo_id, "running fsck")
|
||||
.await;
|
||||
@ -471,6 +477,12 @@ impl GitHookPool {
|
||||
.map_err(crate::GitError::from)?
|
||||
.ok_or_else(|| crate::GitError::NotFound(format!("repo {} not found", repo_id)))?;
|
||||
|
||||
if !std::path::Path::new(&repo.storage_path).exists() {
|
||||
return Err(crate::GitError::NotFound(format!(
|
||||
"storage path does not exist: {}", repo.storage_path
|
||||
)));
|
||||
}
|
||||
|
||||
self.log_stream
|
||||
.info(&task.id, &task.repo_id, "running gc")
|
||||
.await;
|
||||
|
||||
Loading…
Reference in New Issue
Block a user