isolate axum shutdown in router; minor run-cycle/signalling tweaks

Signed-off-by: Jason Volk <jason@zemos.net>
This commit is contained in:
Jason Volk 2024-06-05 19:59:50 +00:00
parent e4aa20ebeb
commit 0e74ade7d7
8 changed files with 57 additions and 72 deletions

View file

@ -13,7 +13,7 @@ use tracing::{debug, error, trace};
pub(crate) async fn spawn(
State(server): State<Arc<Server>>, req: http::Request<axum::body::Body>, next: axum::middleware::Next,
) -> Result<axum::response::Response, StatusCode> {
if server.interrupt.load(Ordering::Relaxed) {
if server.stopping.load(Ordering::Relaxed) {
debug_warn!("unavailable pending shutdown");
return Err(StatusCode::SERVICE_UNAVAILABLE);
}
@ -35,7 +35,7 @@ pub(crate) async fn spawn(
pub(crate) async fn handle(
State(server): State<Arc<Server>>, req: http::Request<axum::body::Body>, next: axum::middleware::Next,
) -> Result<axum::response::Response, StatusCode> {
if server.interrupt.load(Ordering::Relaxed) {
if server.stopping.load(Ordering::Relaxed) {
debug_warn!(
method = %req.method(),
uri = %req.uri(),