From 372e30cf6899aef724fb2f0bd3988c56290985ef Mon Sep 17 00:00:00 2001 From: Davide Date: Thu, 3 Oct 2024 22:25:59 +0200 Subject: [PATCH] Import remote profiles serially (#674) Follow the same approach as #636, because if no profiles are formerly installed the first import will trigger a VPN permission alert. Weird things may happen in that case if profiles are imported in parallel. --- .../Library/Sources/AppLibrary/Business/ProfileManager.swift | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/Passepartout/Library/Sources/AppLibrary/Business/ProfileManager.swift b/Passepartout/Library/Sources/AppLibrary/Business/ProfileManager.swift index c94a5520..81b4bd39 100644 --- a/Passepartout/Library/Sources/AppLibrary/Business/ProfileManager.swift +++ b/Passepartout/Library/Sources/AppLibrary/Business/ProfileManager.swift @@ -260,8 +260,9 @@ private extension ProfileManager { } // pull remote updates into local profiles (best-effort) - for remoteProfile in allRemoteProfiles.values { - Task.detached { [weak self] in + let profilesToImport = allRemoteProfiles.values + Task.detached { [weak self] in + for remoteProfile in profilesToImport { do { pp_log(.app, .notice, "Import remote profile \(remoteProfile.id)...") try await self?.save(remoteProfile)