Skip to main content

serve_http_with_shutdown_future

Function serve_http_with_shutdown_future 

Source
pub async fn serve_http_with_shutdown_future<F>(
    addr: &str,
    api_key_state: ApiKeyState,
    app_state: AppState,
    shutdown: F,
) -> Result<()>
where F: Future<Output = ()> + Send + 'static,
Expand description

Variant of serve_http_with_shutdown that takes an arbitrary shutdown future. The production serve() needs to run a WAL checkpoint after the OS signal but before tearing down the listener; that cleanup work is awkward to express through a Notify alone. Accepting a Future lets the caller embed any async cleanup into the shutdown future itself, while the helper keeps the build_router + TcpListener::bind + axum::serve body it already owns.