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.
This commit is contained in:
Davide 2024-10-03 22:25:59 +02:00 committed by GitHub
parent bf4ec4982a
commit 372e30cf68
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
1 changed files with 3 additions and 2 deletions

View File

@ -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)