Skip to main content

spawn_agent_quota_reset_loop

Function spawn_agent_quota_reset_loop 

Source
pub fn spawn_agent_quota_reset_loop(
    state: Db,
    interval: Duration,
) -> JoinHandle<()>
Expand description

v0.7.0 K8 — spawn the periodic agent-quota daily-counter reset sweeper.

Sleeps interval, then calls crate::quotas::reset_daily against the daemon’s shared connection. The SQL statement zeros current_memories_today + current_links_today for every row whose day_started_at is not the current UTC date — touched rows equal “agents that crossed midnight since the last sweep tick” which is at most one row per registered agent per 24h.

The returned JoinHandle is owned by the caller; serve() aborts it on shutdown — same lifecycle as spawn_pending_timeout_sweep_loop.