From 75cf03d6382bf4237e5bdf76eeddadb4dbc1ef5e Mon Sep 17 00:00:00 2001 From: Markus Unterwaditzer Date: Fri, 30 Jan 2026 14:17:59 +0100 Subject: [PATCH] Fix rayhunter chugging on when diag device failed to initialize Ref #676 -- this is a partial fix for one of the issues mentioned there. I expect that as a result we'll get more bugreports about rayhunter not starting, since right now those errors are "masked" by this bug. --- daemon/src/main.rs | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/daemon/src/main.rs b/daemon/src/main.rs index 429797a..73f1eb6 100644 --- a/daemon/src/main.rs +++ b/daemon/src/main.rs @@ -206,6 +206,10 @@ async fn run_with_config( let (analysis_tx, analysis_rx) = mpsc::channel::(5); let restart_token = CancellationToken::new(); let shutdown_token = restart_token.child_token(); + // Ensure shutdown_token is cancelled when this function exits for any + // reason (e.g. diag device init failure), so all spawned tasks get + // signaled to stop. + let _shutdown_guard = shutdown_token.clone().drop_guard(); let notification_service = NotificationService::new(config.ntfy_url.clone());