Don't send ActiveLeaves from leaves in db on startup in Overseer (#6727)

* Don't send `ActiveLeaves` from leaves in db on startup in Overseer. Wait for fresh leaves instead.

* Don't pass initial set of leaves to Overseer

* Fix compilation error in subsystem-test-helpers
This commit is contained in:
Tsvetomir Dimitrov
2023-03-06 17:02:16 +02:00
committed by GitHub
parent dfb60f32cd
commit ed6fa5499c
6 changed files with 39 additions and 136 deletions
-15
View File
@@ -612,11 +612,6 @@ pub struct Overseer<SupportsParachains> {
/// Stores the [`jaeger::Span`] per active leaf.
pub span_per_active_leaf: HashMap<Hash, Arc<jaeger::Span>>,
/// A set of leaves that `Overseer` starts working with.
///
/// Drained at the beginning of `run` and never used again.
pub leaves: Vec<(Hash, BlockNumber)>,
/// The set of the "active leaves".
pub active_leaves: HashMap<Hash, BlockNumber>,
@@ -728,16 +723,6 @@ where
let metrics = self.metrics.clone();
spawn_metronome_metrics(&mut self, metrics)?;
// Notify about active leaves on startup before starting the loop
for (hash, number) in std::mem::take(&mut self.leaves) {
let _ = self.active_leaves.insert(hash, number);
if let Some((span, status)) = self.on_head_activated(&hash, None).await {
let update =
ActiveLeavesUpdate::start_work(ActivatedLeaf { hash, number, status, span });
self.broadcast_signal(OverseerSignal::ActiveLeaves(update)).await?;
}
}
loop {
select! {
msg = self.events_rx.select_next_some() => {