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:
parent
fdfe1d508b
commit
c46bc0cc82
|
|
@ -385,6 +385,8 @@ where
|
||||||
.repo_policies()?
|
.repo_policies()?
|
||||||
.filter_map(|t| (t.policy == tracking::Policy::Track).then_some(t.id)),
|
.filter_map(|t| (t.policy == tracking::Policy::Track).then_some(t.id)),
|
||||||
);
|
);
|
||||||
|
// Start periodic tasks.
|
||||||
|
self.reactor.wakeup(IDLE_INTERVAL);
|
||||||
|
|
||||||
Ok(())
|
Ok(())
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -22,7 +22,6 @@ use crate::storage::git::transport::remote;
|
||||||
use crate::storage::Inventory;
|
use crate::storage::Inventory;
|
||||||
use crate::storage::{RemoteId, WriteStorage};
|
use crate::storage::{RemoteId, WriteStorage};
|
||||||
use crate::test::arbitrary;
|
use crate::test::arbitrary;
|
||||||
use crate::test::assert_matches;
|
|
||||||
use crate::test::simulator;
|
use crate::test::simulator;
|
||||||
use crate::test::storage::MockStorage;
|
use crate::test::storage::MockStorage;
|
||||||
use crate::Link;
|
use crate::Link;
|
||||||
|
|
@ -281,7 +280,9 @@ where
|
||||||
self.service
|
self.service
|
||||||
.command(Command::Connect(remote_id, remote_addr.clone()));
|
.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.attempted(remote_id, &remote_addr);
|
||||||
self.service.connected(remote_id, Link::Outbound);
|
self.service.connected(remote_id, Link::Outbound);
|
||||||
|
|
|
||||||
|
|
@ -218,7 +218,7 @@ fn test_persistent_peer_connect() {
|
||||||
let mut outbox = alice.outbox();
|
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 == bob.id());
|
||||||
assert_matches!(outbox.next(), Some(Io::Connect(a, _)) if a == eve.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]
|
#[test]
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue