Skip to main content

spawn_gc_loop

Function spawn_gc_loop 

Source
pub fn spawn_gc_loop(
    state: Db,
    archive_max_days: Option<i64>,
    interval: Duration,
) -> JoinHandle<()>
Expand description

Spawn the periodic GC loop. Sleeps interval, then runs db::gc, db::auto_purge_archive, and (Cluster G, #767) the shadow- observation retention sweep against the daemon’s shared connection. The returned JoinHandle is owned by the caller; serve() aborts it on shutdown.

shadow_retention_days honors the operator-tunable [confidence] shadow_retention_days from config.toml, falling back to crate::confidence::shadow::DEFAULT_SHADOW_RETENTION_DAYS (30) when unset. <= 0 disables the sweep (matches the archive_max_days convention).