Skip to main content

until_shutdown

Function until_shutdown 

Source
pub async fn until_shutdown(
    servers: JoinSet<Result<()>>,
    health: &Health,
    shutdown: &CancellationToken,
) -> Result<()>
Expand description

Block until shutdown is cancelled or any task in servers finishes.

Either way, readiness is flipped off, shutdown is cancelled, and the remaining tasks are drained. A task finishing before the shutdown signal — even cleanly — is an error: servers run until told to stop.

§Errors

Returns the first server failure: an exit before shutdown, a serve error surfaced during drain, or a panic.