Skip to main content

spawn_partial_reaper

Function spawn_partial_reaper 

Source
pub fn spawn_partial_reaper(
    store: Arc<TaildropStore>,
    shutdown: Receiver<bool>,
) -> JoinHandle<()>
Expand description

Spawn the background reaper that periodically GCs abandoned .partial files (Go feature/taildrop/delete.go’s fileDeleter). It sweeps every DELETE_DELAY, deleting partials older than DELETE_DELAY that have no in-flight transfer (see TaildropStore::reap_abandoned_partials), and exits when shutdown flips to true.

Returns a JoinHandle the caller should abort on drop so the task never outlives the runtime (the established reauth_bridge / DerpLatencyMeasurer pattern). An Arc<TaildropStore> is held (cheap clone), so the sweep sees live in_flight state.

The first sweep is deferred one full DELETE_DELAY (not run at startup): a partial on disk at boot is by definition at least 0s old, and Go likewise only deletes after the delay elapses, so waiting one interval avoids reaping a partial a just-restarted node might still resume.