node: Start periodic tasks

This change ensures that we start the periodic tasks "loop" by
scheduling the first wakeup during initialization.
This commit is contained in:
Alexis Sellier 2023-03-16 15:15:30 +01:00
parent fdfe1d508b
commit c46bc0cc82
No known key found for this signature in database
3 changed files with 6 additions and 3 deletions

View File

@ -385,6 +385,8 @@ where
.repo_policies()?
.filter_map(|t| (t.policy == tracking::Policy::Track).then_some(t.id)),
);
// Start periodic tasks.
self.reactor.wakeup(IDLE_INTERVAL);
Ok(())
}

View File

@ -22,7 +22,6 @@ use crate::storage::git::transport::remote;
use crate::storage::Inventory;
use crate::storage::{RemoteId, WriteStorage};
use crate::test::arbitrary;
use crate::test::assert_matches;
use crate::test::simulator;
use crate::test::storage::MockStorage;
use crate::Link;
@ -281,7 +280,9 @@ where
self.service
.command(Command::Connect(remote_id, remote_addr.clone()));
assert_matches!(self.outbox().next(), Some(Io::Connect { .. }));
self.outbox()
.find(|o| matches!(o, Io::Connect { .. }))
.unwrap();
self.service.attempted(remote_id, &remote_addr);
self.service.connected(remote_id, Link::Outbound);

View File

@ -218,7 +218,7 @@ fn test_persistent_peer_connect() {
let mut outbox = alice.outbox();
assert_matches!(outbox.next(), Some(Io::Connect(a, _)) if a == bob.id());
assert_matches!(outbox.next(), Some(Io::Connect(a, _)) if a == eve.id());
assert_matches!(outbox.next(), None);
assert_matches!(outbox.find(|o| matches!(o, Io::Connect { .. })), None);
}
#[test]