diff --git a/Account/Sources/Account/CloudKit/CloudKitSendStatusOperation.swift b/Account/Sources/Account/CloudKit/CloudKitSendStatusOperation.swift index 3d5aefabf..5b6c4442d 100644 --- a/Account/Sources/Account/CloudKit/CloudKitSendStatusOperation.swift +++ b/Account/Sources/Account/CloudKit/CloudKitSendStatusOperation.swift @@ -117,7 +117,7 @@ private extension CloudKitSendStatusOperation { articlesZone.modifyArticles(statusUpdates) { result in switch result { case .success: - self.database.deleteSelectedForProcessing(statusUpdates.map({ $0.articleID })) { _ in + self.database.deleteSelectedForProcessing(articleIDs) { _ in // Don't clear the last one since we might have had additional ticks added if self.showProgress && self.refreshProgress?.numberRemaining ?? 0 > 1 { self.refreshProgress?.completeTask() diff --git a/SyncDatabase/Sources/SyncDatabase/SyncStatusTable.swift b/SyncDatabase/Sources/SyncDatabase/SyncStatusTable.swift index fd2043390..0ab0d80cb 100644 --- a/SyncDatabase/Sources/SyncDatabase/SyncStatusTable.swift +++ b/SyncDatabase/Sources/SyncDatabase/SyncStatusTable.swift @@ -114,6 +114,11 @@ struct SyncStatusTable: DatabaseTable { } func resetSelectedForProcessing(_ articleIDs: [String], completion: DatabaseCompletionBlock? = nil) { + guard !articleIDs.isEmpty else { + callCompletion(completion, nil) + return + } + queue.runInTransaction { databaseResult in func makeDatabaseCall(_ database: FMDatabase) { @@ -134,6 +139,11 @@ struct SyncStatusTable: DatabaseTable { } func deleteSelectedForProcessing(_ articleIDs: [String], completion: DatabaseCompletionBlock? = nil) { + guard !articleIDs.isEmpty else { + callCompletion(completion, nil) + return + } + queue.runInTransaction { databaseResult in func makeDatabaseCall(_ database: FMDatabase) {