Skip to content

Commit

Permalink
fix: remove interval
Browse files Browse the repository at this point in the history
  • Loading branch information
gruberb committed Apr 25, 2024
1 parent b7cbb30 commit 125b772
Showing 1 changed file with 22 additions and 25 deletions.
47 changes: 22 additions & 25 deletions crates/topos-tce-broadcast/src/task_manager/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -116,7 +116,6 @@ impl TaskManager {

pub async fn run(mut self, shutdown_receiver: CancellationToken) {
let mut pending_certificate_interval = tokio::time::interval(Duration::from_millis(10));
let mut double_echo_messages_interval = tokio::time::interval(Duration::from_millis(50));

loop {
tokio::select! {
Expand All @@ -126,34 +125,32 @@ impl TaskManager {
self.next_pending_certificate();
}

_ = double_echo_messages_interval.tick() => {
if let Some(msg) = self.message_receiver.recv().await {
match msg {
DoubleEchoCommand::Echo { certificate_id, .. } | DoubleEchoCommand::Ready { certificate_id, .. } => {
if self.delivered_certificates.contains(&certificate_id) {
trace!("Received message for certificate {} that has already been delivered", certificate_id);
continue;
}
Some(msg) = self.message_receiver.recv() => {
match msg {
DoubleEchoCommand::Echo { certificate_id, .. } | DoubleEchoCommand::Ready { certificate_id, .. } => {
if self.delivered_certificates.contains(&certificate_id) {
trace!("Received message for certificate {} that has already been delivered", certificate_id);
continue;
}

if let Some(task_context) = self.tasks.get(&certificate_id) {
_ = task_context.sink.send(msg).await;
} else {
self.buffered_messages
.entry(certificate_id)
.or_default()
.push(msg);
};
if let Some(task_context) = self.tasks.get(&certificate_id) {
_ = task_context.sink.send(msg).await;
} else {
self.buffered_messages
.entry(certificate_id)
.or_default()
.push(msg);
};
}
DoubleEchoCommand::Broadcast { ref cert, need_gossip, pending_id } => {
if self.delivered_certificates.contains(&cert.id) {
trace!("Received message for certificate {} that has already been delivered", cert.id);
continue;
}
DoubleEchoCommand::Broadcast { ref cert, need_gossip, pending_id } => {
if self.delivered_certificates.contains(&cert.id) {
trace!("Received message for certificate {} that has already been delivered", cert.id);
continue;
}

trace!("Received broadcast message for certificate {} ", cert.id);
trace!("Received broadcast message for certificate {} ", cert.id);

self.create_task(cert, need_gossip, pending_id)
}
self.create_task(cert, need_gossip, pending_id)
}
}
}
Expand Down

0 comments on commit 125b772

Please sign in to comment.