diff --git a/crates/common/src/utils.rs b/crates/common/src/utils.rs index cb2ee89c..6bc99e76 100644 --- a/crates/common/src/utils.rs +++ b/crates/common/src/utils.rs @@ -160,12 +160,21 @@ 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 { + error!("failed to send discord alert: {err}"); + eprintln!("failed to send discord alert: {err}"); + } + }); } pub fn save_to_file(path: PathBuf, json: String) {