Change so that we fire off status update immediately if the number of pending status changes exceeds 100. Issue #658

This commit is contained in:
Maurice Parker
2019-05-27 12:03:12 -05:00
parent fcb2fa3ebc
commit 61f9a66d74
3 changed files with 25 additions and 0 deletions

View File

@@ -39,6 +39,23 @@ final class SyncStatusTable: DatabaseTable {
}
func selectPendingCount() -> Int {
var count: Int = 0
self.queue.fetchSync { (database) in
let sql = "select count(*) from syncStatus"
if let resultSet = database.executeQuery(sql, withArgumentsIn: nil) {
resultSet.next()
count = Int(resultSet.int(forColumnIndex: 0))
}
}
return count
}
func resetSelectedForProcessing(_ articleIDs: [String]) {
self.queue.update { database in
let parameters = articleIDs.map { $0 as AnyObject }