From 4e6c10080431d475e2d593c41b92814542cce4a4 Mon Sep 17 00:00:00 2001 From: Maurice Parker Date: Fri, 11 Nov 2022 19:42:10 -0600 Subject: [PATCH] Continue processing if there is a Feedbin delete error. Fixes #3611 --- .../Feedbin/FeedbinAccountDelegate.swift | 30 ++++++++++--------- 1 file changed, 16 insertions(+), 14 deletions(-) diff --git a/Modules/Account/Sources/Account/Feedbin/FeedbinAccountDelegate.swift b/Modules/Account/Sources/Account/Feedbin/FeedbinAccountDelegate.swift index 1d7dcfe49..a4ae146b7 100644 --- a/Modules/Account/Sources/Account/Feedbin/FeedbinAccountDelegate.swift +++ b/Modules/Account/Sources/Account/Feedbin/FeedbinAccountDelegate.swift @@ -1409,27 +1409,29 @@ private extension FeedbinAccountDelegate { completion(.failure(FeedbinAccountDelegateError.invalidParameter)) return } + + func complete() { + DispatchQueue.main.async { + account.clearWebFeedMetadata(feed) + account.removeWebFeed(feed) + if let folders = account.folders { + for folder in folders { + folder.removeWebFeed(feed) + } + } + completion(.success(())) + } + } refreshProgress.addToNumberOfTasksAndRemaining(1) caller.deleteSubscription(subscriptionID: subscriptionID) { result in self.refreshProgress.completeTask() switch result { case .success: - DispatchQueue.main.async { - account.clearWebFeedMetadata(feed) - account.removeWebFeed(feed) - if let folders = account.folders { - for folder in folders { - folder.removeWebFeed(feed) - } - } - completion(.success(())) - } + complete() case .failure(let error): - DispatchQueue.main.async { - let wrappedError = AccountError.wrappedError(error: error, account: account) - completion(.failure(wrappedError)) - } + self.logger.error("Unable to remove feed from Feedbin. Removing locally and continue processing: \(error.localizedDescription, privacy: .public)") + complete() } }