Check if the queue is suspended before attempting to index articles in the database.

This commit is contained in:
Brent Simmons 2019-12-03 21:56:52 -08:00
parent d93a4441d7
commit d03b2b0277
2 changed files with 4 additions and 1 deletions

View File

@ -428,6 +428,9 @@ final class ArticlesTable: DatabaseTable {
// MARK: - Indexing // MARK: - Indexing
func indexUnindexedArticles() { func indexUnindexedArticles() {
guard !queue.isSuspended else {
return
}
queue.runInDatabase { (database) in queue.runInDatabase { (database) in
let sql = "select articleID from articles where searchRowID is null limit 500;" let sql = "select articleID from articles where searchRowID is null limit 500;"
guard let resultSet = database.executeQuery(sql, withArgumentsIn: nil) else { guard let resultSet = database.executeQuery(sql, withArgumentsIn: nil) else {

View File

@ -70,7 +70,7 @@ final class SearchTable: DatabaseTable {
} }
func ensureIndexedArticles(for articleIDs: Set<String>) { func ensureIndexedArticles(for articleIDs: Set<String>) {
if articleIDs.isEmpty { guard !queue.isSuspended && !articleIDs.isEmpty else {
return return
} }
queue.runInTransaction { (database) in queue.runInTransaction { (database) in