Remove synchronous sync database status insert function.

This commit is contained in:
Maurice Parker
2020-10-25 12:32:12 -05:00
parent 45f5776b7e
commit cba900d4e4
9 changed files with 35 additions and 55 deletions

View File

@@ -407,11 +407,11 @@ final class CloudKitAccountDelegate: AccountDelegate {
return SyncStatus(articleID: article.articleID, key: SyncStatus.Key(statusKey), flag: flag)
}
try? self.database.insertStatuses(syncStatuses)
self.database.selectPendingCount { result in
if let count = try? result.get(), count > 100 {
self.sendArticleStatus(for: account, showProgress: false) { _ in }
self.database.insertStatuses(syncStatuses) { _ in
self.database.selectPendingCount { result in
if let count = try? result.get(), count > 100 {
self.sendArticleStatus(for: account, showProgress: false) { _ in }
}
}
}
case .failure(let error):

View File

@@ -148,8 +148,9 @@ private extension CloudKitArticlesZoneDelegate {
return
}
let syncStatuses = deletes.map { SyncStatus(articleID: $0.articleID, key: .deleted, flag: true) }
try? self.database.insertStatuses(syncStatuses)
group.leave()
self.database.insertStatuses(syncStatuses) { _ in
group.leave()
}
case .failure(let databaseError):
errorOccurred = true
os_log(.error, log: self.log, "Error occurred while storing articles: %@", databaseError.localizedDescription)

View File

@@ -443,11 +443,11 @@ final class FeedWranglerAccountDelegate: AccountDelegate {
return SyncStatus(articleID: article.articleID, key: SyncStatus.Key(statusKey), flag: flag)
}
try? self.database.insertStatuses(syncStatuses)
self.database.selectPendingCount { result in
if let count = try? result.get(), count > 100 {
self.sendArticleStatus(for: account) { _ in }
self.database.insertStatuses(syncStatuses) { _ in
self.database.selectPendingCount { result in
if let count = try? result.get(), count > 100 {
self.sendArticleStatus(for: account) { _ in }
}
}
}
case .failure(let error):

View File

@@ -542,11 +542,11 @@ final class FeedbinAccountDelegate: AccountDelegate {
return SyncStatus(articleID: article.articleID, key: SyncStatus.Key(statusKey), flag: flag)
}
try? self.database.insertStatuses(syncStatuses)
self.database.selectPendingCount { result in
if let count = try? result.get(), count > 100 {
self.sendArticleStatus(for: account) { _ in }
self.database.insertStatuses(syncStatuses) { _ in
self.database.selectPendingCount { result in
if let count = try? result.get(), count > 100 {
self.sendArticleStatus(for: account) { _ in }
}
}
}
case .failure(let error):

View File

@@ -495,11 +495,11 @@ final class FeedlyAccountDelegate: AccountDelegate {
return SyncStatus(articleID: article.articleID, key: SyncStatus.Key(statusKey), flag: flag)
}
try? self.database.insertStatuses(syncStatuses)
self.database.selectPendingCount { result in
if let count = try? result.get(), count > 100 {
self.sendArticleStatus(for: account) { _ in }
self.database.insertStatuses(syncStatuses) { _ in
self.database.selectPendingCount { result in
if let count = try? result.get(), count > 100 {
self.sendArticleStatus(for: account) { _ in }
}
}
}
case .failure(let error):

View File

@@ -581,11 +581,11 @@ final class NewsBlurAccountDelegate: AccountDelegate {
return SyncStatus(articleID: article.articleID, key: SyncStatus.Key(statusKey), flag: flag)
}
try? self.database.insertStatuses(syncStatuses)
self.database.selectPendingCount { result in
if let count = try? result.get(), count > 100 {
self.sendArticleStatus(for: account) { _ in }
self.database.insertStatuses(syncStatuses) { _ in
self.database.selectPendingCount { result in
if let count = try? result.get(), count > 100 {
self.sendArticleStatus(for: account) { _ in }
}
}
}
case .failure(let error):

View File

@@ -472,11 +472,11 @@ final class ReaderAPIAccountDelegate: AccountDelegate {
return SyncStatus(articleID: article.articleID, key: SyncStatus.Key(statusKey), flag: flag)
}
try? self.database.insertStatuses(syncStatuses)
self.database.selectPendingCount { result in
if let count = try? result.get(), count > 100 {
self.sendArticleStatus(for: account) { _ in }
self.database.insertStatuses(syncStatuses) { _ in
self.database.selectPendingCount { result in
if let count = try? result.get(), count > 100 {
self.sendArticleStatus(for: account) { _ in }
}
}
}
case .failure(let error):