File tree 1 file changed +5
-2
lines changed
1 file changed +5
-2
lines changed Original file line number Diff line number Diff line change @@ -8,7 +8,7 @@ use std::{
8
8
task:: { Context , Poll } ,
9
9
time:: Duration ,
10
10
} ;
11
- use tokio:: time:: { interval , Interval , MissedTickBehavior } ;
11
+ use tokio:: time:: { Instant , Interval , MissedTickBehavior } ;
12
12
13
13
const DEFAULT_DUMP_INTERVAL : Duration = Duration :: from_secs ( 3600 ) ; // 1 hour
14
14
@@ -52,7 +52,10 @@ impl Future for DumpPeerStoreService {
52
52
fn poll ( mut self : Pin < & mut Self > , cx : & mut Context < ' _ > ) -> Poll < Self :: Output > {
53
53
if self . interval . is_none ( ) {
54
54
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
+ ) ;
56
59
// The dump peer store service does not need to urgently compensate for the missed wake,
57
60
// just delay behavior is enough
58
61
interval. set_missed_tick_behavior ( MissedTickBehavior :: Delay ) ;
You can’t perform that action at this time.
0 commit comments