|
|
@ -34,19 +34,11 @@ pub struct GroupHandle { |
|
|
|
pub internal: GroupInternal, |
|
|
|
pub internal: GroupInternal, |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
#[derive(Debug)] |
|
|
|
#[derive(Debug, Default)] |
|
|
|
pub struct GroupInternal { |
|
|
|
pub struct GroupInternal { |
|
|
|
recently_seen_notif_statuses: VecDeque<String>, |
|
|
|
recently_seen_notif_statuses: VecDeque<String>, |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
impl Default for GroupInternal { |
|
|
|
|
|
|
|
fn default() -> Self { |
|
|
|
|
|
|
|
Self { |
|
|
|
|
|
|
|
recently_seen_notif_statuses: VecDeque::new(), |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
#[macro_export] |
|
|
|
#[macro_export] |
|
|
|
macro_rules! grp_debug { |
|
|
|
macro_rules! grp_debug { |
|
|
|
($self:ident, $f:expr) => { |
|
|
|
($self:ident, $f:expr) => { |
|
|
@ -138,11 +130,11 @@ impl GroupHandle { |
|
|
|
match self.run_internal().await { |
|
|
|
match self.run_internal().await { |
|
|
|
Ok(()) => unreachable!(), |
|
|
|
Ok(()) => unreachable!(), |
|
|
|
Err(e @ GroupError::BadConfig(_)) => { |
|
|
|
Err(e @ GroupError::BadConfig(_)) => { |
|
|
|
grp_error!(self, "ERROR in group handler, aborting! {}", e); |
|
|
|
grp_error!(self, "ERROR in group handler, aborting! {:?}", e); |
|
|
|
return Err(e); |
|
|
|
return Err(e); |
|
|
|
} |
|
|
|
} |
|
|
|
Err(other) => { |
|
|
|
Err(other) => { |
|
|
|
grp_error!(self, "ERROR in group handler, will restart! {}", other); |
|
|
|
grp_error!(self, "ERROR in group handler, will restart! {:?}", other); |
|
|
|
tokio::time::sleep(Duration::from_secs_f64(self.cc.delay_reopen_error_s)).await; |
|
|
|
tokio::time::sleep(Duration::from_secs_f64(self.cc.delay_reopen_error_s)).await; |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
@ -175,7 +167,7 @@ impl GroupHandle { |
|
|
|
grp_debug!(self, "No notifs missed"); |
|
|
|
grp_debug!(self, "No notifs missed"); |
|
|
|
} |
|
|
|
} |
|
|
|
Err(e) => { |
|
|
|
Err(e) => { |
|
|
|
grp_error!(self, "Failed to handle missed notifs: {}", e); |
|
|
|
grp_error!(self, "Failed to handle missed notifs: {:?}", e); |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
@ -189,7 +181,7 @@ impl GroupHandle { |
|
|
|
grp_debug!(self, "No statuses missed"); |
|
|
|
grp_debug!(self, "No statuses missed"); |
|
|
|
} |
|
|
|
} |
|
|
|
Err(e) => { |
|
|
|
Err(e) => { |
|
|
|
grp_error!(self, "Failed to handle missed statuses: {}", e); |
|
|
|
grp_error!(self, "Failed to handle missed statuses: {:?}", e); |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|