From c8b838a3c2b4445d7ef5ecf5dae4fb9e5b1b0268 Mon Sep 17 00:00:00 2001 From: Sam Symons Date: Fri, 5 Apr 2024 15:28:55 -0700 Subject: [PATCH] Add retry logic when uninstalling the VPN. --- .../Waitlist/NetworkProtectionFeatureDisabler.swift | 13 ++++++++++++- 1 file changed, 12 insertions(+), 1 deletion(-) diff --git a/DuckDuckGo/Waitlist/NetworkProtectionFeatureDisabler.swift b/DuckDuckGo/Waitlist/NetworkProtectionFeatureDisabler.swift index ba12c9cdd2..4505ba73d1 100644 --- a/DuckDuckGo/Waitlist/NetworkProtectionFeatureDisabler.swift +++ b/DuckDuckGo/Waitlist/NetworkProtectionFeatureDisabler.swift @@ -102,7 +102,18 @@ final class NetworkProtectionFeatureDisabler: NetworkProtectionFeatureDisabling } } - try? await removeVPNConfiguration() + var attemptNumber = 1 + while attemptNumber <= 3 { + do { + try await removeVPNConfiguration() + break // Removal succeeded, break out of the while loop and continue with the rest of uninstallation + } catch { + print("Failed to remove VPN configuration, with error: \(error.localizedDescription)") + } + + attemptNumber += 1 + } + // We want to give some time for the login item to reset state before disabling it try? await Task.sleep(interval: 0.5) disableLoginItems()