From c4bedb1756c96db3f7d01feedc6587f7b0c3dc0f Mon Sep 17 00:00:00 2001 From: stuebinm Date: Tue, 16 Apr 2024 22:14:40 +0200 Subject: don't fail on failed ntfy connection not sure how my thought process went wrong here (perhaps i only considered ntfy might reject the request for auth reasons?), but as it was if ntfy was ever not available this thing would just fail permanently. --- src/main.rs | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/src/main.rs b/src/main.rs index ed9c8a7..6e8b82d 100644 --- a/src/main.rs +++ b/src/main.rs @@ -1,5 +1,5 @@ use tokio::sync::Mutex; -use std::{process::exit, sync::Arc, path::PathBuf, str::FromStr}; +use std::{sync::Arc, path::PathBuf, str::FromStr}; use matrix_sdk::{ config::SyncSettings, ruma::{events::room::message::RoomMessageEventContent, OwnedRoomOrAliasId}, Client, Room, encryption::EncryptionSettings, }; @@ -152,8 +152,9 @@ async fn read_ntfy(config: &Options, rooms_to_notify: Arc>>) -> }; if !req.status().is_success() { - tracing::error!("fatal: ntfy sent status {}", req.status()); - exit(1); + tracing::error!("ntfy sent status {}, will retry ..", req.status()); + tokio::time::sleep(tokio::time::Duration::from_millis(5000)).await; + return Ok(()); } let stream = req -- cgit v1.2.3