From e777a27a95fd4bc53adfabd9f057e1899f2f13d7 Mon Sep 17 00:00:00 2001 From: Yureka Date: Wed, 22 Nov 2023 12:27:06 +0100 Subject: [PATCH] remove future after it has failed --- src/main.rs | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/src/main.rs b/src/main.rs index 43f6679..03ad41c 100644 --- a/src/main.rs +++ b/src/main.rs @@ -62,9 +62,10 @@ async fn main() -> anyhow::Result<()> { info!("shutting down on signal SIGTERM"); Ok(()) } - task_ended = select_all(&mut futures) => { + (result, idx, _) = select_all(&mut futures) => { warn!("shutting down because task unexpectedly ended"); - task_ended.0? + futures.remove(idx); + result? } }; shutdown_tx.send(true)?;