mirror of
https://github.com/sigp/lighthouse.git
synced 2026-03-03 00:31:50 +00:00
Fix beacon-processor-max-workers (#4636)
## Issue Addressed Fixes a bug in the handling of `--beacon-process-max-workers` which caused it to have no effect. ## Proposed Changes For this PR I channeled @ethDreamer and saw deep into the faulty CLI config -- this bug is almost identical to the one Mark found and fixed in #4622.
This commit is contained in:
@@ -708,7 +708,6 @@ impl<E: EthSpec> Stream for InboundEvents<E> {
|
||||
pub struct BeaconProcessor<E: EthSpec> {
|
||||
pub network_globals: Arc<NetworkGlobals<E>>,
|
||||
pub executor: TaskExecutor,
|
||||
pub max_workers: usize,
|
||||
pub current_workers: usize,
|
||||
pub config: BeaconProcessorConfig,
|
||||
pub log: Logger,
|
||||
@@ -721,7 +720,7 @@ impl<E: EthSpec> BeaconProcessor<E> {
|
||||
/// - Performed immediately, if a worker is available.
|
||||
/// - Queued for later processing, if no worker is currently available.
|
||||
///
|
||||
/// Only `self.max_workers` will ever be spawned at one time. Each worker is a `tokio` task
|
||||
/// Only `self.config.max_workers` will ever be spawned at one time. Each worker is a `tokio` task
|
||||
/// started with `spawn_blocking`.
|
||||
///
|
||||
/// The optional `work_journal_tx` allows for an outside process to receive a log of all work
|
||||
@@ -896,7 +895,7 @@ impl<E: EthSpec> BeaconProcessor<E> {
|
||||
let _ = work_journal_tx.try_send(id);
|
||||
}
|
||||
|
||||
let can_spawn = self.current_workers < self.max_workers;
|
||||
let can_spawn = self.current_workers < self.config.max_workers;
|
||||
let drop_during_sync = work_event
|
||||
.as_ref()
|
||||
.map_or(false, |event| event.drop_during_sync);
|
||||
|
||||
Reference in New Issue
Block a user