Skip to content

Commit

Permalink
Auto correct queues table if there are items when there shouldn't be any
Browse files Browse the repository at this point in the history
  • Loading branch information
almasaeed2010 committed Apr 1, 2019
1 parent 46d5799 commit 59e716e
Showing 1 changed file with 4 additions and 1 deletion.
5 changes: 4 additions & 1 deletion includes/Elasticsearch/ESQueue.php
Original file line number Diff line number Diff line change
Expand Up @@ -57,7 +57,7 @@ public static function progress() {
$should_check = (int) db_query("SELECT COUNT(*)
FROM queue
WHERE name LIKE :es", [
':es' => db_like('elasticsearch').'%',
':es' => db_like('elasticsearch') . '%',
])->fetchField();

$queues = [];
Expand All @@ -73,6 +73,9 @@ public static function progress() {
ORDER BY index_name ASC, priority ASC';
$queues = db_query($query)->fetchAll();
}
elseif (intval(db_query('SELECT COUNT(*) FROM {' . self::QUEUE_TABLE . '} WHERE completed < total')->fetchField())) {
db_query('UPDATE {' . self::QUEUE_TABLE . '} SET completed = total')->fetchAll();
}

$progress = [];
$total = 0;
Expand Down

0 comments on commit 59e716e

Please sign in to comment.