Skip to content

Commit be98c46

Browse files
committed
revert
1 parent c82ca76 commit be98c46

File tree

1 file changed

+5
-2
lines changed

1 file changed

+5
-2
lines changed

network/src/services/dump_peer_store.rs

+5-2
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@ use std::{
88
task::{Context, Poll},
99
time::Duration,
1010
};
11-
use tokio::time::{interval, Interval, MissedTickBehavior};
11+
use tokio::time::{Instant, Interval, MissedTickBehavior};
1212

1313
const DEFAULT_DUMP_INTERVAL: Duration = Duration::from_secs(3600); // 1 hour
1414

@@ -52,7 +52,10 @@ impl Future for DumpPeerStoreService {
5252
fn poll(mut self: Pin<&mut Self>, cx: &mut Context<'_>) -> Poll<Self::Output> {
5353
if self.interval.is_none() {
5454
self.interval = {
55-
let mut interval = interval(DEFAULT_DUMP_INTERVAL);
55+
let mut interval = tokio::time::interval_at(
56+
Instant::now() + DEFAULT_DUMP_INTERVAL,
57+
DEFAULT_DUMP_INTERVAL,
58+
);
5659
// The dump peer store service does not need to urgently compensate for the missed wake,
5760
// just delay behavior is enough
5861
interval.set_missed_tick_behavior(MissedTickBehavior::Delay);

0 commit comments

Comments
 (0)