From d2cb834d29c65895ba3252092a8606b18f41ec83 Mon Sep 17 00:00:00 2001 From: Raphael Date: Sat, 12 Sep 2026 11:29:10 +0200 Subject: [PATCH] fix: setting free flights to release thier memory occupation --- crates/taurus/src/app/worker.rs | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/crates/taurus/src/app/worker.rs b/crates/taurus/src/app/worker.rs index a64ee26..1889d9b 100644 --- a/crates/taurus/src/app/worker.rs +++ b/crates/taurus/src/app/worker.rs @@ -169,6 +169,16 @@ pub fn spawn_worker( sub_flow_execution_closed = true; log::info!("NATS worker received shutdown signal"); } + // Reclaim finished tasks as they complete. Without this arm + // `in_flight` only drains after the loop exits (shutdown), + // so every completed execution's `JoinSet` entry would sit + // unreclaimed for the process's entire lifetime -- memory + // climbing with every execution and never coming back down. + Some(result) = in_flight.join_next(), if !in_flight.is_empty() => { + if let Err(err) = result { + log::error!("In-flight execution task panicked or was cancelled: {:?}", err); + } + } } }