Use dedicated Queues for each from-to pair

Prevents one Processor's message from halting the entire pipeline.
This commit is contained in:
Luke Parker
2023-09-27 12:20:57 -04:00
parent 269db1c4be
commit 40b7bc59d0
12 changed files with 142 additions and 125 deletions

View File

@@ -222,13 +222,15 @@ impl Coordinator {
/// Receive a message from a processor as its coordinator.
pub async fn recv_message(&mut self) -> ProcessorMessage {
let msg =
tokio::time::timeout(core::time::Duration::from_secs(10), self.queue.next(self.next_recv_id))
.await
.unwrap();
let msg = tokio::time::timeout(
core::time::Duration::from_secs(10),
self.queue.next(Service::Processor(self.network)),
)
.await
.unwrap();
assert_eq!(msg.from, Service::Processor(self.network));
assert_eq!(msg.id, self.next_recv_id);
self.queue.ack(self.next_recv_id).await;
self.queue.ack(Service::Processor(self.network), msg.id).await;
self.next_recv_id += 1;
serde_json::from_slice(&msg.msg).unwrap()
}