dyn overseer channel capacity (#5454)

* allow runtime adjustment of signal channel size

Closes #5436
This commit is contained in:
Bernhard Schuster
2022-05-05 17:22:17 +02:00
committed by GitHub
parent 2e1a3441f9
commit abf882c591
8 changed files with 104 additions and 11 deletions
+10
View File
@@ -719,6 +719,7 @@ pub fn new_full<RuntimeApi, ExecutorDispatch, OverseerGenerator>(
program_path: Option<std::path::PathBuf>,
overseer_enable_anyways: bool,
overseer_gen: OverseerGenerator,
overseer_message_channel_capacity_override: Option<usize>,
hwbench: Option<sc_sysinfo::HwBench>,
) -> Result<NewFull<Arc<FullClient<RuntimeApi, ExecutorDispatch>>>, Error>
where
@@ -1038,6 +1039,7 @@ where
chain_selection_config,
dispute_coordinator_config,
pvf_checker_enabled,
overseer_message_channel_capacity_override,
},
)
.map_err(|e| {
@@ -1326,6 +1328,7 @@ pub fn build_full(
telemetry_worker_handle: Option<TelemetryWorkerHandle>,
overseer_enable_anyways: bool,
overseer_gen: impl OverseerGen,
overseer_message_channel_override: Option<usize>,
hwbench: Option<sc_sysinfo::HwBench>,
) -> Result<NewFull<Client>, Error> {
#[cfg(feature = "rococo-native")]
@@ -1343,6 +1346,7 @@ pub fn build_full(
None,
overseer_enable_anyways,
overseer_gen,
overseer_message_channel_override,
hwbench,
)
.map(|full| full.with_client(Client::Rococo))
@@ -1360,6 +1364,7 @@ pub fn build_full(
None,
overseer_enable_anyways,
overseer_gen,
overseer_message_channel_override,
hwbench,
)
.map(|full| full.with_client(Client::Kusama))
@@ -1377,6 +1382,7 @@ pub fn build_full(
None,
overseer_enable_anyways,
overseer_gen,
overseer_message_channel_override,
hwbench,
)
.map(|full| full.with_client(Client::Westend))
@@ -1394,6 +1400,10 @@ pub fn build_full(
None,
overseer_enable_anyways,
overseer_gen,
overseer_message_channel_override.map(|capacity| {
gum::warn!("Channel capacity should _never_ be tampered with on polkadot!");
capacity
}),
hwbench,
)
.map(|full| full.with_client(Client::Polkadot))
+9 -1
View File
@@ -111,6 +111,8 @@ where
pub dispute_coordinator_config: DisputeCoordinatorConfig,
/// Enable PVF pre-checking
pub pvf_checker_enabled: bool,
/// Overseer channel capacity override.
pub overseer_message_channel_capacity_override: Option<usize>,
}
/// Obtain a prepared `OverseerBuilder`, that is initialized
@@ -138,6 +140,7 @@ pub fn prepared_overseer_builder<'a, Spawner, RuntimeClient>(
chain_selection_config,
dispute_coordinator_config,
pvf_checker_enabled,
overseer_message_channel_capacity_override,
}: OverseerGenArgs<'a, Spawner, RuntimeClient>,
) -> Result<
InitializedOverseerBuilder<
@@ -292,7 +295,12 @@ where
.known_leaves(LruCache::new(KNOWN_LEAVES_CACHE_SIZE))
.metrics(metrics)
.spawner(spawner);
Ok(builder)
if let Some(capacity) = overseer_message_channel_capacity_override {
Ok(builder.message_channel_capacity(capacity))
} else {
Ok(builder)
}
}
/// Trait for the `fn` generating the overseer.