From 5a178ba393b112b268c59f1fcf24d1d8b1ed9956 Mon Sep 17 00:00:00 2001 From: Lambda Date: Sun, 19 May 2024 18:28:11 +0000 Subject: [PATCH] Add comment to task spawner middleware --- src/main.rs | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/src/main.rs b/src/main.rs index ddfc8e18..25fa6ff0 100644 --- a/src/main.rs +++ b/src/main.rs @@ -274,6 +274,10 @@ async fn run_server() -> io::Result<()> { Ok(()) } +/// Ensures the request runs in a new tokio thread. +/// +/// The axum request handler task gets cancelled if the connection is shut down; +/// by spawning our own task, processing continue after the client disconnects. async fn spawn_task( req: axum::http::Request, next: axum::middleware::Next,