Use a local DB channel for sending to the message-queue

The provided message-queue queue functions runs unti it succeeds. This means
sending to the message-queue will no longer potentially block for arbitrary
amount of times as sending messages is just writing them to a DB.
This commit is contained in:
Luke Parker
2024-09-11 19:29:56 -04:00
parent b6811f9015
commit 0d4c8cf032
4 changed files with 96 additions and 84 deletions

View File

@@ -158,7 +158,7 @@ async fn first_block_after_time<S: ScannerFeed>(feed: &S, serai_time: u64) -> u6
}
/// The main loop of a Processor, interacting with the Coordinator.
pub async fn coordinator_loop<
pub async fn main_loop<
S: ScannerFeed,
K: KeyGenParams<ExternalNetworkCiphersuite: Ciphersuite<G = KeyFor<S>>>,
Sch: Scheduler<
@@ -192,7 +192,7 @@ pub async fn coordinator_loop<
if let messages::key_gen::ProcessorMessage::GeneratedKeyPair { session, .. } = &msg {
new_key = Some(*session)
}
coordinator.send_message(messages::ProcessorMessage::KeyGen(msg)).await;
coordinator.send_message(&messages::ProcessorMessage::KeyGen(msg));
}
// If we were yielded a key, register it in the signers