Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
21 changes: 15 additions & 6 deletions crates/common/src/utils.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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) {
Expand Down
Loading