pub fn spawn_session_sweeper(db: Db)Expand description
Periodic maintenance loop — every 10 minutes, sweep:
- Expired sessions (
auth::purge_expired_sessions) — removes rows fromrustio_sessionswhereexpires_at < NOW(). - Reset-token rows past their forensic-retention window
(
auth::recovery::purge_expired_reset_tokens— R1 commit #12) — removes rows fromrustio_password_reset_tokenswhereexpires_at < NOW() - INTERVAL '7 days'.
Failure isolation: the two sweeps run sequentially within
each tick but each handles its own Result — a failure in one
does NOT prevent the other from running, and neither prevents
the next tick. The next tick happens unconditionally on the
timer.
The 10-minute interval is kept from R0; reset-token sweeping piggy-backs on the existing tick rather than spawning a second timer loop.
(The function name is preserved for backwards compatibility —
downstream projects already call spawn_session_sweeper
directly. The expanded scope is documented above.)