mirror of
https://github.com/pezkuwichain/pezkuwi-subxt.git
synced 2026-06-14 05:11:09 +00:00
Do not run unneeded subsystems on collator and its alongside node (#3061)
Currently, collators and their alongside nodes spin up a full-scale overseer running a bunch of subsystems that are not needed if the node is not a validator. That was considered to be harmless; however, we've got problems with unused subsystems getting stalled for a reason not currently known, resulting in the overseer exiting and bringing down the whole node. This PR aims to only run needed subsystems on such nodes, replacing the rest with `DummySubsystem`. It also enables collator-optimized availability recovery subsystem implementation. Partially solves #1730.
This commit is contained in:
@@ -49,29 +49,24 @@ use self::{
|
||||
|
||||
/// PVF pre-checking subsystem.
|
||||
pub struct PvfCheckerSubsystem {
|
||||
enabled: bool,
|
||||
keystore: KeystorePtr,
|
||||
metrics: Metrics,
|
||||
}
|
||||
|
||||
impl PvfCheckerSubsystem {
|
||||
pub fn new(enabled: bool, keystore: KeystorePtr, metrics: Metrics) -> Self {
|
||||
PvfCheckerSubsystem { enabled, keystore, metrics }
|
||||
pub fn new(keystore: KeystorePtr, metrics: Metrics) -> Self {
|
||||
PvfCheckerSubsystem { keystore, metrics }
|
||||
}
|
||||
}
|
||||
|
||||
#[overseer::subsystem(PvfChecker, error=SubsystemError, prefix = self::overseer)]
|
||||
impl<Context> PvfCheckerSubsystem {
|
||||
fn start(self, ctx: Context) -> SpawnedSubsystem {
|
||||
if self.enabled {
|
||||
let future = run(ctx, self.keystore, self.metrics)
|
||||
.map_err(|e| SubsystemError::with_origin("pvf-checker", e))
|
||||
.boxed();
|
||||
let future = run(ctx, self.keystore, self.metrics)
|
||||
.map_err(|e| SubsystemError::with_origin("pvf-checker", e))
|
||||
.boxed();
|
||||
|
||||
SpawnedSubsystem { name: "pvf-checker-subsystem", future }
|
||||
} else {
|
||||
polkadot_overseer::DummySubsystem.start(ctx)
|
||||
}
|
||||
SpawnedSubsystem { name: "pvf-checker-subsystem", future }
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user