Check if the queue is suspended before attempting to index articles in the database.
This commit is contained in:
parent
d93a4441d7
commit
d03b2b0277
|
@ -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 {
|
||||||
|
|
|
@ -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
|
||||||
|
|
Loading…
Reference in New Issue