Skip to content

Commit

Permalink
Send OurViewChange with priority instead of using an unbounded channel
Browse files Browse the repository at this point in the history
  • Loading branch information
AndreiEres committed Sep 2, 2024
1 parent 5291412 commit 2023a95
Showing 1 changed file with 9 additions and 8 deletions.
17 changes: 9 additions & 8 deletions polkadot/node/network/bridge/src/rx/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -826,7 +826,8 @@ where
finalized_number,
&metrics,
&notification_sinks,
);
)
.await;
note_peers_count(&metrics, &shared);
}
}
Expand Down Expand Up @@ -919,7 +920,7 @@ fn construct_view(
}

#[overseer::contextbounds(NetworkBridgeRx, prefix = self::overseer)]
fn update_our_view<Context>(
async fn update_our_view<Context>(
ctx: &mut Context,
live_heads: &[ActivatedLeaf],
shared: &Shared,
Expand Down Expand Up @@ -967,10 +968,12 @@ fn update_our_view<Context>(
finalized_number,
);

dispatch_validation_event_to_all_unbounded(
dispatch_validation_event_to_all(
NetworkBridgeEvent::OurViewChange(our_view.clone()),
ctx.sender(),
);
&metrics,
)
.await;

dispatch_collation_event_to_all_unbounded(
NetworkBridgeEvent::OurViewChange(our_view),
Expand Down Expand Up @@ -1140,12 +1143,10 @@ async fn dispatch_validation_events_to_all<I>(
if let Ok(event) = $event.focus() {
let has_high_priority = matches!(
event,
// NetworkBridgeEvent::OurViewChange(..) must also be here,
// but it is sent via an unbounded channel.
// See https://github.com/paritytech/polkadot-sdk/issues/824
NetworkBridgeEvent::PeerConnected(..) |
NetworkBridgeEvent::PeerDisconnected(..) |
NetworkBridgeEvent::PeerViewChange(..)
NetworkBridgeEvent::PeerViewChange(..) |
NetworkBridgeEvent::OurViewChange(..)
);
let message = $message::from(event);
if has_high_priority {
Expand Down

0 comments on commit 2023a95

Please sign in to comment.