Skip to content

Commit 5e1da03

Browse files
authored
Rewrite the chain listener as a single loop. (#3745)
## Motivation For #365 the chain listener will need to react to new block notifications on a publisher chain by processing the inboxes of all subscriber chains. That is difficult to implement with the current approach: we run a notification processing loop in a separate task for each chain. ## Proposal Rewrite the chain listener so that there is a single top-level loop processing all events on all chains. That will make it easier to update chains based on events from _other_ chains. `process_new_events` already does this, to update all non-admin chains for new epochs. ## Test Plan CI ## Release Plan - Nothing to do / These changes follow the usual release cycle. ## Links - Preparation for #365. - [reviewer checklist](https://github.com/linera-io/linera-protocol/blob/main/CONTRIBUTING.md#reviewer-checklist)
1 parent ea93965 commit 5e1da03

File tree

11 files changed

+292
-189
lines changed

11 files changed

+292
-189
lines changed

Cargo.lock

Lines changed: 1 addition & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

linera-base/src/task.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -138,10 +138,10 @@ mod implementation {
138138
}
139139

140140
/// The type of a future awaiting another task.
141-
pub type NonblockingFuture<R> = oneshot::Receiver<R>;
141+
pub type NonBlockingFuture<R> = oneshot::Receiver<R>;
142142

143143
/// Spawns a new task on the current thread.
144-
pub fn spawn<F: Future + 'static>(future: F) -> NonblockingFuture<F::Output> {
144+
pub fn spawn<F: Future + 'static>(future: F) -> NonBlockingFuture<F::Output> {
145145
let (send, recv) = oneshot::channel();
146146
wasm_bindgen_futures::spawn_local(async {
147147
let _ = send.send(future.await);

linera-client/Cargo.toml

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,6 @@ test = ["linera-views/test", "linera-execution/test"]
1616
benchmark = [
1717
"linera-base/test",
1818
"dep:linera-sdk",
19-
"dep:tokio-util",
2019
"dep:crossbeam-channel",
2120
"dep:num-format",
2221
"dep:reqwest",
@@ -80,7 +79,7 @@ thiserror.workspace = true
8079
thiserror-context.workspace = true
8180
tokio.workspace = true
8281
tokio-stream.workspace = true
83-
tokio-util = { workspace = true, optional = true }
82+
tokio-util.workspace = true
8483
tracing.workspace = true
8584
trait-variant.workspace = true
8685

0 commit comments

Comments
 (0)