various: eliminate redundant disk check; improve error handling

Signed-off-by: NotAShelf <raf@notashelf.dev>
Change-Id: I1f37cc60380790bc1bf11f143194ad116a6a6964
This commit is contained in:
raf 2026-02-05 22:48:02 +03:00
commit 1c18306822
Signed by: NotAShelf
GPG key ID: 29D95B64378DB4BF
5 changed files with 39 additions and 23 deletions

View file

@ -87,28 +87,29 @@ async fn evaluate_jobset(
"Starting evaluation cycle"
);
if let Err(e) = check_disk_space(&work_dir) {
tracing::warn!(
jobset = %jobset.name,
"Disk space check failed: {}. Proceeding anyway...",
e
);
}
if let Ok(info) = check_disk_space(&work_dir) {
if info.is_critical() {
tracing::error!(
jobset = %jobset.name,
"CRITICAL: Less than 1GB disk space available. {}",
info.summary()
);
} else if info.is_low() {
match check_disk_space(&work_dir) {
Ok(info) => {
if info.is_critical() {
tracing::error!(
jobset = %jobset.name,
"CRITICAL: Less than 1GB disk space available. {}",
info.summary()
);
} else if info.is_low() {
tracing::warn!(
jobset = %jobset.name,
"LOW: Less than 5GB disk space available. {}",
info.summary()
);
}
},
Err(e) => {
tracing::warn!(
jobset = %jobset.name,
"LOW: Less than 5GB disk space available. {}",
info.summary()
"Disk space check failed: {}. Proceeding anyway...",
e
);
}
},
}
// Clone/fetch in a blocking task (git2 is sync) with timeout