Skip to main content

flush_all

Function flush_all 

Source
pub fn flush_all()
Expand description

Flush every buffered telemetry sink to disk.

The long-lived MCP daemon flushes these once at shutdown (cli/dispatch/server.rs). Single-shot CLI commands — and the shadow-mode hook subprocesses that spawn lean-ctx read/grep — exit immediately, so without this the buffered heatmap, mode-predictor, feedback and threshold writes are silently lost the moment the process ends: lean-ctx heatmap stays empty and lean-ctx gain reports nothing for compressed reads (#550).

Centralized so the daemon shutdown, the parent watchdog and every CLI tool command flush the exact same set — the historical per-arm copies had drifted (the read arm flushed only stats, the -c arm four sinks, the daemon nine), which is precisely how the gap went unnoticed.