From b50427b3839c1134f581d0b292fb986e9a221e1e Mon Sep 17 00:00:00 2001 From: Systemcluster Date: Tue, 6 Aug 2024 09:51:49 +0200 Subject: [PATCH] Graceful shutdown Hyper connection --- crates/example-tests/src/lib.rs | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/crates/example-tests/src/lib.rs b/crates/example-tests/src/lib.rs index 0486e8fd19e..7a5e360d57f 100644 --- a/crates/example-tests/src/lib.rs +++ b/crates/example-tests/src/lib.rs @@ -354,14 +354,17 @@ pub async fn test_example( let conn = builder.serve_connection(TokioIo::new(stream), &service); tokio::pin!(conn); - tokio::select! { + let ret = tokio::select! { res = conn.as_mut() => { res.map_err(|e| anyhow::Error::msg(e.to_string())) } _ = rx => { Ok(()) } - } + }; + + conn.graceful_shutdown(); + ret }, async { #[derive(Deserialize)]