diff options
| author | Sebastian Holmin <sebastian.holmin@mullvad.net> | 2023-12-18 12:12:17 +0100 |
|---|---|---|
| committer | Jonathan <jonathan@mullvad.net> | 2023-12-21 13:33:59 +0100 |
| commit | 98b7117405d95b005e1211b4decbc71664388e7f (patch) | |
| tree | dd878c3069bbb786ccccf3d961747b93d0ead1e0 | |
| parent | ce7f4f73f82295275631ef05dbe12ba17843ec2d (diff) | |
| download | mullvadvpn-98b7117405d95b005e1211b4decbc71664388e7f.tar.xz mullvadvpn-98b7117405d95b005e1211b4decbc71664388e7f.zip | |
Change to exponential retry delay
| -rw-r--r-- | mullvad-daemon/src/geoip.rs | 10 |
1 files changed, 5 insertions, 5 deletions
diff --git a/mullvad-daemon/src/geoip.rs b/mullvad-daemon/src/geoip.rs index 02ee09d1c0..0af495e8bd 100644 --- a/mullvad-daemon/src/geoip.rs +++ b/mullvad-daemon/src/geoip.rs @@ -8,12 +8,9 @@ use mullvad_api::{ }; use mullvad_types::location::{AmIMullvad, GeoIpLocation}; use once_cell::sync::Lazy; -use talpid_core::future_retry::{retry_future, ConstantInterval}; +use talpid_core::future_retry::{retry_future, ExponentialBackoff, Jittered}; use talpid_types::ErrorExt; -/// Retry interval for fetching location -const RETRY_LOCATION_STRATEGY: ConstantInterval = ConstantInterval::new(Duration::ZERO, Some(3)); - // Define the Mullvad connection checking api endpoint. // // In a development build the host name for the connection checking endpoint can @@ -43,6 +40,9 @@ static MULLVAD_CONNCHECK_HOST: Lazy<String> = Lazy::new(|| { host.to_string() }); +const LOCATION_RETRY_STRATEGY: Jittered<ExponentialBackoff> = + Jittered::jitter(ExponentialBackoff::new(Duration::from_secs(1), 4)); + /// Fetch the current `GeoIpLocation` with retrys pub async fn get_geo_location( rest_service: RequestServiceHandle, @@ -56,7 +56,7 @@ pub async fn get_geo_location( Err(error) if error.is_network_error() => !api_handle.get_state().is_offline(), _ => false, }, - RETRY_LOCATION_STRATEGY, + LOCATION_RETRY_STRATEGY, ) .await { |
