Skip to content

Commit 86776e3

Browse files
committed
re-queue broadcast even if we didn't send it out
Signed-off-by: Somtochi Onyekwere <[email protected]>
1 parent c76a010 commit 86776e3

File tree

1 file changed

+17
-20
lines changed
  • crates/corro-agent/src/broadcast

1 file changed

+17
-20
lines changed

crates/corro-agent/src/broadcast/mod.rs

Lines changed: 17 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -764,28 +764,25 @@ async fn handle_broadcasts(
764764

765765
counter!("corro.broadcast.spawn", "type" => "global").increment(spawn_count);
766766

767-
if pending_sent_instance != pending.sent_to.len() {
768-
// we've sent this to at least 1 member...
769-
770-
if let Some(send_count) = pending.send_count.checked_add(1) {
771-
trace!("send_count: {send_count}, max_transmissions: {max_transmissions}");
772-
pending.send_count = send_count;
773-
774-
if send_count < max_transmissions {
775-
debug!("queueing for re-send");
776-
idle_pendings.push(Box::pin(async move {
777-
// slow our send pace if we've been previously rate limited
778-
let sleep_ms_base = if prev_rate_limited { 500 } else { 100 };
779-
// send with increasing latency as we've already sent the updates out
780-
tokio::time::sleep(Duration::from_millis(
781-
sleep_ms_base * send_count as u64,
782-
))
783-
.await;
784-
pending
785-
}));
786-
}
767+
if let Some(send_count) = pending.send_count.checked_add(1) {
768+
trace!("send_count: {send_count}, max_transmissions: {max_transmissions}");
769+
pending.send_count = send_count;
770+
771+
if send_count < max_transmissions {
772+
debug!("queueing for re-send");
773+
idle_pendings.push(Box::pin(async move {
774+
// slow our send pace if we've been previously rate limited
775+
let sleep_ms_base = if prev_rate_limited { 500 } else { 100 };
776+
// send with increasing latency as we've already sent the updates out
777+
tokio::time::sleep(Duration::from_millis(
778+
sleep_ms_base * send_count as u64,
779+
))
780+
.await;
781+
pending
782+
}));
787783
}
788784
}
785+
789786
}
790787
}
791788

0 commit comments

Comments
 (0)