diff options
| author | David Lönnhager <david.l@mullvad.net> | 2023-09-17 16:42:18 +0200 |
|---|---|---|
| committer | David Lönnhager <david.l@mullvad.net> | 2023-09-19 14:07:32 +0200 |
| commit | c8b9da33986f9d64b4c4e84324d2bb92fffc52f3 (patch) | |
| tree | dd63d827c8d57a880ceecf88419a202a4b3d9f56 /mullvad-setup | |
| parent | ae6a4a1d9fba88aa6b3a23f6fe1252bf474e99eb (diff) | |
| download | mullvadvpn-c8b9da33986f9d64b4c4e84324d2bb92fffc52f3.tar.xz mullvadvpn-c8b9da33986f9d64b4c4e84324d2bb92fffc52f3.zip | |
Simplify immediate retry strategy
Diffstat (limited to 'mullvad-setup')
| -rw-r--r-- | mullvad-setup/src/main.rs | 10 |
1 files changed, 4 insertions, 6 deletions
diff --git a/mullvad-setup/src/main.rs b/mullvad-setup/src/main.rs index a349554ca6..bcae459442 100644 --- a/mullvad-setup/src/main.rs +++ b/mullvad-setup/src/main.rs @@ -6,15 +6,14 @@ use once_cell::sync::Lazy; use std::{path::PathBuf, process, str::FromStr, time::Duration}; use talpid_core::{ firewall::{self, Firewall}, - future_retry::{constant_interval, retry_future_n}, + future_retry::{retry_future, ConstantInterval}, }; use talpid_types::ErrorExt; static APP_VERSION: Lazy<ParsedAppVersion> = Lazy::new(|| ParsedAppVersion::from_str(mullvad_version::VERSION).unwrap()); -const KEY_RETRY_INTERVAL: Duration = Duration::ZERO; -const KEY_RETRY_MAX_RETRIES: usize = 4; +const DEVICE_REMOVAL_STRATEGY: ConstantInterval = ConstantInterval::new(Duration::ZERO, Some(5)); #[repr(i32)] enum ExitStatus { @@ -171,14 +170,13 @@ async fn remove_device() -> Result<(), Error> { .await, ); - let device_removal = retry_future_n( + let device_removal = retry_future( move || proxy.remove(device.account_token.clone(), device.device.id.clone()), move |result| match result { Err(error) => error.is_network_error(), _ => false, }, - constant_interval(KEY_RETRY_INTERVAL), - KEY_RETRY_MAX_RETRIES, + DEVICE_REMOVAL_STRATEGY, ) .await; |
