Skip to content

Commit d6e179d

Browse files
committed
TASK: Change count() to countReady() and improve system report
1 parent d0b41a5 commit d6e179d

File tree

1 file changed

+6
-3
lines changed

1 file changed

+6
-3
lines changed

Classes/Command/NodeIndexQueueCommandController.php

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -104,7 +104,7 @@ public function buildCommand($workspace = null)
104104
$this->outputLine();
105105
$this->outputLine('<b>Indexing on %s ...</b>', [$indexName]);
106106

107-
$pendingJobs = $this->queueManager->getQueue(self::BATCH_QUEUE_NAME)->count();
107+
$pendingJobs = $this->queueManager->getQueue(self::BATCH_QUEUE_NAME)->countReady();
108108
if ($pendingJobs !== 0) {
109109
$this->outputLine('<error>!! </error> The queue "%s" is not empty (%d pending jobs), please flush the queue.', [self::BATCH_QUEUE_NAME, $pendingJobs]);
110110
$this->quit(1);
@@ -223,9 +223,12 @@ protected function outputSystemReport()
223223
$this->outputLine('Execution time : %s seconds', [$time]);
224224
$this->outputLine('Indexing Queue : %s', [self::BATCH_QUEUE_NAME]);
225225
try {
226-
$this->outputLine('Pending Jobs : %s', [$this->queueManager->getQueue(self::BATCH_QUEUE_NAME)->count()]);
226+
$queue = $this->queueManager->getQueue(self::BATCH_QUEUE_NAME);
227+
$this->outputLine('Pending Jobs : %s', [$queue->countReady()]);
228+
$this->outputLine('Reserved Jobs : %s', [$queue->countReserved()]);
229+
$this->outputLine('Failed Jobs : %s', [$queue->countFailed()]);
227230
} catch (Exception $exception) {
228-
$this->outputLine('Pending Jobs : Error, queue not found, %s', [$exception->getMessage()]);
231+
$this->outputLine('Pending Jobs : Error, queue %s not found, %s', [self::BATCH_QUEUE_NAME, $exception->getMessage()]);
229232
}
230233
}
231234

0 commit comments

Comments
 (0)