Spawn the task to select validators to dial

This commit is contained in:
Luke Parker
2025-01-07 18:16:34 -05:00
parent 419223c54e
commit 2121a9b131
3 changed files with 27 additions and 11 deletions

View File

@@ -28,13 +28,19 @@ const TARGET_PEERS_PER_NETWORK: usize = 5;
*/
// TODO const TARGET_DIALED_PEERS_PER_NETWORK: usize = 3;
struct DialTask {
pub(crate) struct DialTask {
serai: Serai,
validators: Validators,
peers: Peers,
to_dial: mpsc::UnboundedSender<DialOpts>,
}
impl DialTask {
pub(crate) fn new(serai: Serai, peers: Peers, to_dial: mpsc::UnboundedSender<DialOpts>) -> Self {
DialTask { serai: serai.clone(), validators: Validators::new(serai), peers, to_dial }
}
}
impl ContinuallyRan for DialTask {
// Only run every five minutes, not the default of every five seconds
const DELAY_BETWEEN_ITERATIONS: u64 = 5 * 60;