Make SyncDatabase selectPendingCount async.

This commit is contained in:
Brent Simmons
2019-12-16 10:50:13 -08:00
parent 894d3909a3
commit 7a134740ec
6 changed files with 37 additions and 29 deletions

View File

@@ -402,8 +402,10 @@ final class ReaderAPIAccountDelegate: AccountDelegate {
}
database.insertStatuses(syncStatuses)
if database.selectPendingCount() > 100 {
sendArticleStatus(for: account) { _ in }
database.selectPendingCount { result in
if let count = try? result.get(), count > 100 {
self.sendArticleStatus(for: account) { _ in }
}
}
return account.update(articles, statusKey: statusKey, flag: flag)