Skip to main content

start_forgetting_loop

Function start_forgetting_loop 

Source
pub fn start_forgetting_loop(
    store: Arc<SqliteStore>,
    config: ForgettingConfig,
    cancel: CancellationToken,
) -> JoinHandle<()>
Expand description

Start the background forgetting loop (SleepGate).

The loop runs every config.sweep_interval_secs seconds, independently of the consolidation loop. Both share the same SqliteStore without a lock because SQLite WAL mode handles concurrent writers safely — each sweep runs inside a single transaction, so consolidation merges always see either the pre-sweep or post-sweep state, never an intermediate state.

Database errors are logged but do not stop the loop.