Skip to main content

Module background_thread

Module background_thread 

Source
Expand description

Per-session request loop.

Each Session spawns one thread running background_loop. The loop pulls SessionMessages off the session’s mpsc channel and runs each request on the session’s SessionState through crate::api, with the session’s settings.

Running requests serially per session is what keeps state consistent across many concurrent requests in the same session: a pack.save followed by a pack.close always sees the right pack, even when the WebSocket multiplexer is firing requests as fast as the client sends them. The exception are diagnostics checks: they stop when other requests arrive, and get queued again behind them, so a check never makes the client wait.

Telemetry: each request is recorded via rpfm_telemetry::record_action so usage counters reflect what the session actually did.

Functions§

background_loop
The per-session request loop.