Skip to content
This repository has been archived by the owner on Nov 15, 2023. It is now read-only.

Adds start and stop work heartbeats. #1188

Merged
merged 5 commits into from
Jun 3, 2020
Merged
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
16 changes: 11 additions & 5 deletions overseer/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -498,7 +498,7 @@ where
/// # }); }
/// ```
pub fn new(
leaves: impl Into<Vec<BlockInfo>>,
leaves: impl IntoIterator<Item = BlockInfo>,
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🙏

validation: Box<dyn Subsystem<ValidationSubsystemMessage> + Send>,
candidate_backing: Box<dyn Subsystem<CandidateBackingSubsystemMessage> + Send>,
mut s: S,
Expand Down Expand Up @@ -528,7 +528,7 @@ where

let active_leaves = HashSet::new();

let leaves = leaves.into()
let leaves = leaves
.into_iter()
.map(|BlockInfo { hash, parent_hash: _, number }| (hash, number))
.collect();
Expand Down Expand Up @@ -650,7 +650,6 @@ where
}
});


for hash in stop_these.into_iter() {
self.broadcast_signal(OverseerSignal::StopWork(hash)).await?
}
Expand Down Expand Up @@ -1072,8 +1071,15 @@ mod tests {
}
}

assert_eq!(ss5_results, expected_heartbeats);
assert_eq!(ss6_results, expected_heartbeats);
assert_eq!(ss5_results.len(), expected_heartbeats.len());
assert_eq!(ss6_results.len(), expected_heartbeats.len());

// Notifications on finality for multiple blocks at once
// may be received in different orders.
for expected in expected_heartbeats {
assert!(ss5_results.contains(&expected));
assert!(ss6_results.contains(&expected));
}
});
}
}