You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
refactor(node): collapse the five periodic GC/log runners into one spawn_periodic helper #1250
crates/node/src/runtime/mod.rs:167-418 holds five near-identical periodic runners — run_dispatch_gc, run_region_accounting_log, run_record_store_gc, run_dht_rate_limit_gc, run_probe_rate_limit_gc — each repeating the same tokio::time::interval + select! { biased; stop | tick } shape (~250 lines), plus five matching oneshot::channel::<()> stop channels minted and fired individually in run().
Proposed fix
One spawn_periodic(name, interval, tick_fn)-style helper returning a stop handle, plus five closures that delegate to the existing domain sweeps (gc_per_source, gc_per_ip, RecordStore::gc, the region-accounting log). Fold the per-runner oneshot minting/firing into the helper/handle.
Constraints to preserve verbatim:
the biased; stop-before-tick select ordering — the *_exits_promptly_on_shutdown tests (runtime/mod.rs:3570-3752) pin prompt-shutdown behavior, and the inline comments at mod.rs:261-264 / 327-334 warn against restructuring the loop body (a uniform wrapper is fine; splitting the body is not);
per-runner tick intervals and log levels.
~150-200 prod lines saved. Adjacent (not in scope here): the broader shutdown/teardown registry idea should wait for #1236 (WatcherHandle ownership inversion) — this issue is only the periodic-runner shape.
Risk
Low — behavior-preserving wrapper; the shutdown-promptness tests catch regressions.
Activity
refactor(node): collapse the five periodic GC/log runners into one sp…