Skip to content

Graceful shutdown #528

Description

@ivan770

Tide could store JoinHandle of every request it handles, and await them when server is shutting down.

tide/src/server.rs

Lines 300 to 311 in 7d0b848

task::spawn(async move {
let res = async_h1::accept(&addr, stream, |req| async {
let res = this.respond(req).await;
let res = res.map_err(|_| io::Error::from(io::ErrorKind::Other))?;
Ok(res)
})
.await;
if let Err(err) = res {
log::error!("async-h1 error", { error: err.to_string() });
}
});

async-std book

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions