master
Ondřej Hruška 3 years ago
parent b9dcf22016
commit 6734917d9c
  1. 16
      src/group_handler/mod.rs

@ -214,8 +214,6 @@ impl GroupHandle {
}
'rx: loop {
// TODO add timeout to catch lock-ups!
if next_save < Instant::now() {
grp_trace!(self, "Save time elapsed, saving if needed");
self.save_if_needed().await.log_error("Failed to save group");
@ -234,13 +232,13 @@ impl GroupHandle {
break 'rx;
}
grp_trace!(self, "Waiting for message");
let timeout = next_save
.saturating_duration_since(Instant::now())
.min(remains_to_idle_close)
.min(remains_to_retire)
.max(Duration::from_secs(1)); // at least 1s
grp_debug!(self, "Wait for message {:?}", timeout);
match tokio::time::timeout(timeout, events.next()).await {
Ok(Some(event)) => {
last_rx = Instant::now();
@ -265,18 +263,6 @@ impl GroupHandle {
// Timeout so we can save if needed
}
}
/* ping is nice, but pleroma still sometimes doesnt send
notifs after a while, just let it expire */
// if last_ping.elapsed() > PING_INTERVAL {
// last_ping = Instant::now();
// grp_trace!(self, "Pinging");
// if events.send_ping()
// .await.is_err() {
// break 'rx;
// }
// }
}
grp_warn!(self, "Notif stream closed, will reopen");

Loading…
Cancel
Save