diff options
| author | David Lönnhager <david.l@mullvad.net> | 2021-10-28 18:55:09 +0200 |
|---|---|---|
| committer | David Lönnhager <david.l@mullvad.net> | 2021-10-28 19:23:50 +0200 |
| commit | efd6c2718ce3a4f7dc50c92b026720b36991b62c (patch) | |
| tree | 18fb3021460380e417db9c7947eda0eac588f71b | |
| parent | 59e566da23466ae16f0289a522243593aae1205d (diff) | |
| download | mullvadvpn-efd6c2718ce3a4f7dc50c92b026720b36991b62c.tar.xz mullvadvpn-efd6c2718ce3a4f7dc50c92b026720b36991b62c.zip | |
Fix initial relay list check interval
| -rw-r--r-- | mullvad-daemon/Cargo.toml | 2 | ||||
| -rw-r--r-- | mullvad-daemon/src/relays.rs | 10 |
2 files changed, 7 insertions, 5 deletions
diff --git a/mullvad-daemon/Cargo.toml b/mullvad-daemon/Cargo.toml index 24d21209f3..dc00d46853 100644 --- a/mullvad-daemon/Cargo.toml +++ b/mullvad-daemon/Cargo.toml @@ -24,7 +24,7 @@ rand = "0.7" regex = "1.0" serde = { version = "1.0", features = ["derive"] } serde_json = "1.0" -tokio = { version = "1.8", features = [ "fs", "rt-multi-thread", "sync" ] } +tokio = { version = "1.8", features = [ "fs", "rt-multi-thread", "sync", "time" ] } tokio-stream = "0.1" uuid = { version = "0.8", features = ["v4"] } diff --git a/mullvad-daemon/src/relays.rs b/mullvad-daemon/src/relays.rs index 59ecdc4345..f1f5ec8e9e 100644 --- a/mullvad-daemon/src/relays.rs +++ b/mullvad-daemon/src/relays.rs @@ -1046,10 +1046,12 @@ impl RelayListUpdater { } async fn run(mut self, mut cmd_rx: mpsc::Receiver<bool>) { - let mut check_interval = tokio_stream::wrappers::IntervalStream::new( - tokio::time::interval(UPDATE_CHECK_INTERVAL), - ) - .fuse(); + let mut check_interval = + tokio_stream::wrappers::IntervalStream::new(tokio::time::interval_at( + (Instant::now() + UPDATE_CHECK_INTERVAL).into(), + UPDATE_CHECK_INTERVAL, + )) + .fuse(); let mut download_future = Box::pin(Fuse::terminated()); loop { futures::select! { |
