make more subsystems blocking, fix blocking subsystem spawning (#5133)

* make more subsystems blocking

* actually spawn blocking subsystems on their own threads
This commit is contained in:
Robert Habermeier
2022-03-16 01:41:20 -05:00
committed by GitHub
parent 2ead4ce12d
commit 5904ae418e
2 changed files with 4 additions and 4 deletions
@@ -594,7 +594,7 @@ pub(crate) fn impl_task_kind(info: &OverseerInfo) -> proc_macro2::TokenStream {
struct Blocking; struct Blocking;
impl TaskKind for Blocking { impl TaskKind for Blocking {
fn launch_task<S: SpawnNamed>(spawner: &mut S, task_name: &'static str, subsystem_name: &'static str, future: BoxFuture<'static, ()>) { fn launch_task<S: SpawnNamed>(spawner: &mut S, task_name: &'static str, subsystem_name: &'static str, future: BoxFuture<'static, ()>) {
spawner.spawn(task_name, Some(subsystem_name), future) spawner.spawn_blocking(task_name, Some(subsystem_name), future)
} }
} }
+3 -3
View File
@@ -462,19 +462,19 @@ pub struct Overseer<SupportsParachains> {
#[subsystem(ApprovalDistributionMessage)] #[subsystem(ApprovalDistributionMessage)]
approval_distribution: ApprovalDistribution, approval_distribution: ApprovalDistribution,
#[subsystem(no_dispatch, ApprovalVotingMessage)] #[subsystem(no_dispatch, blocking, ApprovalVotingMessage)]
approval_voting: ApprovalVoting, approval_voting: ApprovalVoting,
#[subsystem(GossipSupportMessage)] #[subsystem(GossipSupportMessage)]
gossip_support: GossipSupport, gossip_support: GossipSupport,
#[subsystem(no_dispatch, DisputeCoordinatorMessage)] #[subsystem(no_dispatch, blocking, DisputeCoordinatorMessage)]
dispute_coordinator: DisputeCoordinator, dispute_coordinator: DisputeCoordinator,
#[subsystem(no_dispatch, DisputeDistributionMessage)] #[subsystem(no_dispatch, DisputeDistributionMessage)]
dispute_distribution: DisputeDistribution, dispute_distribution: DisputeDistribution,
#[subsystem(no_dispatch, ChainSelectionMessage)] #[subsystem(no_dispatch, blocking, ChainSelectionMessage)]
chain_selection: ChainSelection, chain_selection: ChainSelection,
/// External listeners waiting for a hash to be in the active-leave set. /// External listeners waiting for a hash to be in the active-leave set.