diff options
| -rw-r--r-- | mullvad-daemon/src/relays/updater.rs | 15 | ||||
| -rw-r--r-- | mullvad-daemon/src/wireguard.rs | 1 |
2 files changed, 8 insertions, 8 deletions
diff --git a/mullvad-daemon/src/relays/updater.rs b/mullvad-daemon/src/relays/updater.rs index 521eee3cda..0c06beb43f 100644 --- a/mullvad-daemon/src/relays/updater.rs +++ b/mullvad-daemon/src/relays/updater.rs @@ -75,16 +75,16 @@ impl RelayListUpdater { } async fn run(mut self, mut cmd_rx: mpsc::Receiver<()>) { - 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 check_interval = tokio::time::interval_at( + (Instant::now() + UPDATE_CHECK_INTERVAL).into(), + UPDATE_CHECK_INTERVAL, + ); + check_interval.set_missed_tick_behavior(tokio::time::MissedTickBehavior::Skip); + let mut ticker = tokio_stream::wrappers::IntervalStream::new(check_interval).fuse(); let mut download_future = Box::pin(Fuse::terminated()); loop { futures::select! { - _check_update = check_interval.next() => { + _check_update = ticker.select_next_some() => { if download_future.is_terminated() && self.should_update() { let tag = self.parsed_relays.lock().tag().map(|tag| tag.to_string()); download_future = Box::pin(Self::download_relay_list(self.api_availability.clone(), self.rpc_client.clone(), tag).fuse()); @@ -94,7 +94,6 @@ impl RelayListUpdater { new_relay_list = download_future => { self.consume_new_relay_list(new_relay_list).await; - }, cmd = cmd_rx.next() => { diff --git a/mullvad-daemon/src/wireguard.rs b/mullvad-daemon/src/wireguard.rs index e363a2d3dc..eb198b858b 100644 --- a/mullvad-daemon/src/wireguard.rs +++ b/mullvad-daemon/src/wireguard.rs @@ -354,6 +354,7 @@ impl KeyManager { async fn wait_for_key_expiry(key: &PublicKey, rotation_interval_secs: u64) { let mut interval = tokio::time::interval(KEY_CHECK_INTERVAL); + interval.set_missed_tick_behavior(tokio::time::MissedTickBehavior::Skip); loop { interval.tick().await; if (Utc::now().signed_duration_since(key.created)).num_seconds() as u64 |
