Skip to content

Commit

Permalink
revert
Browse files Browse the repository at this point in the history
  • Loading branch information
driftluo committed Oct 25, 2024
1 parent c82ca76 commit be98c46
Showing 1 changed file with 5 additions and 2 deletions.
7 changes: 5 additions & 2 deletions network/src/services/dump_peer_store.rs
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ use std::{
task::{Context, Poll},
time::Duration,
};
use tokio::time::{interval, Interval, MissedTickBehavior};
use tokio::time::{Instant, Interval, MissedTickBehavior};

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

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

0 comments on commit be98c46

Please sign in to comment.