Skip to content

Commit

Permalink
Async event handler combiner now collects all handlers results, befor…
Browse files Browse the repository at this point in the history
…e reducing the error for reporting
  • Loading branch information
zaychenko-sergei committed Nov 27, 2023
1 parent 7454c76 commit 3338514
Showing 1 changed file with 4 additions and 2 deletions.
6 changes: 4 additions & 2 deletions src/utils/event-bus/src/event_bus.rs
Original file line number Diff line number Diff line change
Expand Up @@ -93,7 +93,8 @@ impl EventBus {
.map(|handler| handler.handle(event))
.collect();

futures::future::try_join_all(async_handler_futures).await?;
let results = futures::future::join_all(async_handler_futures).await;
results.into_iter().try_for_each(|res| res)?;

Ok(())
}
Expand All @@ -116,7 +117,8 @@ impl EventBus {
.map(|handler| (*handler).call((event_arc.clone(),)))
.collect();

futures::future::try_join_all(closure_handler_futures).await?;
let results = futures::future::join_all(closure_handler_futures).await;
results.into_iter().try_for_each(|res| res)?;
}

Ok(())
Expand Down

0 comments on commit 3338514

Please sign in to comment.