Make message_queue::client::Client::send fallible

Allows tasks to report the errors themselves and handle retry in our
standardized way.
This commit is contained in:
Luke Parker
2025-01-11 21:57:58 -05:00
parent f501d46d44
commit d854807edd
4 changed files with 35 additions and 29 deletions

View File

@@ -69,8 +69,7 @@ impl<P: P2p> ContinuallyRan for SubstrateTask<P> {
intent: msg.intent(),
};
let msg = borsh::to_vec(&msg).unwrap();
// TODO: Make this fallible
self.message_queue.queue(metadata, msg).await;
self.message_queue.queue(metadata, msg).await?;
txn.commit();
made_progress = true;
}
@@ -132,8 +131,7 @@ impl<P: P2p> ContinuallyRan for SubstrateTask<P> {
intent: msg.intent(),
};
let msg = borsh::to_vec(&msg).unwrap();
// TODO: Make this fallible
self.message_queue.queue(metadata, msg).await;
self.message_queue.queue(metadata, msg).await?;
// Commit the transaction for all of this
txn.commit();