Skip to main content

drain_turn_held_for_slot

Function drain_turn_held_for_slot 

Source
pub(crate) fn drain_turn_held_for_slot(
    workspace: &Arc<Workspace>,
    slot: &SessionSlot,
)
Expand description

Deliver everything held for slot while a turn was in flight, in the order it arrived. Called where the turn’s Result lands, so each held prompt starts a turn of its own instead of folding into the one that was running. A prompt the seat cannot take now - the session died between the hold and the turn end - is told to its sender rather than dropped, which is the whole point of holding it.

The boundary’s own settle is the session task’s, since it knows which turn ended; this drain clears no liveness. The take shares its lock with a concurrent hold’s check-and-enqueue, so a delivery decides on delivery_hold_signal either before this drain (and is delivered by it) or after (and is delivered directly).