Skip to content

Graceful shutdown #528

@ivan770

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

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions