Skip to content

Commit

Permalink
Don't block on subscribe. (linera-io#2673)
Browse files Browse the repository at this point in the history
  • Loading branch information
afck authored Oct 21, 2024
1 parent 292f679 commit 4f128f6
Showing 1 changed file with 11 additions and 5 deletions.
16 changes: 11 additions & 5 deletions linera-core/src/client/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -3022,13 +3022,19 @@ where
let hash_map::Entry::Vacant(entry) = senders.entry(name) else {
continue;
};
let (mut stream, abort) = match node.subscribe(vec![chain_id]).await {
Err(error) => {
let stream = stream::once({
let node = node.clone();
async move { node.subscribe(vec![chain_id]).await }
})
.filter_map(move |result| async move {
if let Err(error) = &result {
info!(?error, "Could not connect to validator {name}");
continue;
}
Ok(stream) => stream::abortable(stream),
};
result.ok()
})
.flatten();
let (stream, abort) = stream::abortable(stream);
let mut stream = Box::pin(stream);
let this = self.clone();
let local_node = local_node.clone();
let remote_node = RemoteNode { name, node };
Expand Down

0 comments on commit 4f128f6

Please sign in to comment.