Skip to main content

Module stop_handle

Module stop_handle 

Source
Expand description

A background task’s CancellationToken paired with its JoinHandle in one type, so cancel-before-join is structural rather than call-site discipline.

The receipt writer (crate::receipt_log::spawn_receipt_writer) and the warming-credit aggregator (crate::warming_allowance::spawn_warming_creditor) are each a drain loop whose queue senders live inside long-lived holders such as crate::handlers::client::ClientHandler. Awaiting such a task’s bare JoinHandle without first cancelling its token hangs until every sender drops — which for those holders is never. StopHandle carries the token and the handle as one value, and StopHandle::shutdown — the only way to join the task — always cancels before it awaits.

Structs§

StopHandle
A spawned background task and the CancellationToken that stops it.