From c3dacfd32b47b9474e64bf2c5c0919706236f22f Mon Sep 17 00:00:00 2001 From: Ocheretovich Oksana Date: Thu, 26 Feb 2026 09:18:10 +0200 Subject: [PATCH 1/2] make panic hook discord alert non-blocking --- crates/common/src/utils.rs | 20 ++++++++++++++------ 1 file changed, 14 insertions(+), 6 deletions(-) diff --git a/crates/common/src/utils.rs b/crates/common/src/utils.rs index cb2ee89c..e574291a 100644 --- a/crates/common/src/utils.rs +++ b/crates/common/src/utils.rs @@ -160,12 +160,20 @@ pub fn alert_discord(message: &str) { let content = HashMap::from([("content", msg)]); - if let Err(err) = - reqwest::blocking::Client::new().post(webhook_url.clone()).json(&content).send() - { - error!("failed to send discord alert: {err}"); - eprintln!("failed to send discord alert: {err}"); - } + let webhook_url = webhook_url.clone(); + let content = content.clone(); + + std::thread::spawn(move || { + let res = reqwest::blocking::Client::new() + .post(webhook_url) + .json(&content) + .timeout(std::time::Duration::from_secs(3)) + .send(); + + if let Err(err) = res { + eprintln!("failed to send discord alert: {err}"); + } + }); } pub fn save_to_file(path: PathBuf, json: String) { From db9c10bd1c8e1722e1ad739a658b69a80e235b58 Mon Sep 17 00:00:00 2001 From: Ocheretovich Oksana Date: Thu, 26 Feb 2026 09:28:36 +0200 Subject: [PATCH 2/2] log discord alert failure via tracing as well --- crates/common/src/utils.rs | 1 + 1 file changed, 1 insertion(+) diff --git a/crates/common/src/utils.rs b/crates/common/src/utils.rs index e574291a..6bc99e76 100644 --- a/crates/common/src/utils.rs +++ b/crates/common/src/utils.rs @@ -171,6 +171,7 @@ pub fn alert_discord(message: &str) { .send(); if let Err(err) = res { + error!("failed to send discord alert: {err}"); eprintln!("failed to send discord alert: {err}"); } });