perf: skip missed ticks on all intervals, reduce scan frequency
Prevents burst of health checks, scans, and snapshots after slow podman responses by using MissedTickBehavior::Skip. Bumps container scan interval from 30s to 60s to reduce DB lock contention. Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
This commit is contained in:
co-authored by
Claude Opus 4.6
parent
4fc6c103ba
commit
0ecfdd1d01
@@ -277,9 +277,12 @@ impl Server {
|
||||
error!("Failed to scan containers: {}", e);
|
||||
}
|
||||
|
||||
// Periodic scan every 30 seconds (only broadcasts if state changed)
|
||||
// Periodic scan every 60 seconds (only broadcasts if state changed)
|
||||
// Uses an in-flight guard to skip scans when a previous one is still running
|
||||
let mut interval = tokio::time::interval(Duration::from_secs(30));
|
||||
let mut interval = tokio::time::interval(Duration::from_secs(60));
|
||||
// Skip missed ticks instead of catching up — prevents burst of scans
|
||||
// after a slow podman response (which causes DB lock storms)
|
||||
interval.set_missed_tick_behavior(tokio::time::MissedTickBehavior::Skip);
|
||||
let scanning = std::sync::Arc::new(std::sync::atomic::AtomicBool::new(false));
|
||||
loop {
|
||||
interval.tick().await;
|
||||
|
||||
Reference in New Issue
Block a user