mirror of
https://github.com/thegeneralist01/archivr
synced 2026-07-21 18:55:36 +02:00
feat(capture): mark stalled running jobs failed on server startup
This commit is contained in:
parent
cfd51778b1
commit
da2b58ef96
1 changed files with 11 additions and 0 deletions
|
|
@ -26,6 +26,17 @@ async fn main() -> Result<()> {
|
|||
|
||||
let app = routes::app(registry.clone(), auth_db_path.clone());
|
||||
|
||||
// On startup, mark any jobs that were 'running' when the server last stopped as 'failed'.
|
||||
for archive in ®istry.archives {
|
||||
if let Ok(conn) = archivr_core::database::open_or_initialize(&archive.archive_path) {
|
||||
match archivr_core::database::fail_stalled_capture_jobs(&conn) {
|
||||
Ok(n) if n > 0 => eprintln!("info: marked {n} stalled capture job(s) as failed in '{}'", archive.id),
|
||||
Err(e) => eprintln!("warn: stalled job cleanup failed for '{}': {e:#}", archive.id),
|
||||
_ => {}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// Spawn session cleanup: runs at startup and every 24h.
|
||||
let cleanup_auth_path = auth_db_path.clone();
|
||||
tokio::spawn(async move {
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue