Skip to content

Commit

Permalink
Fix elapsed seconds for single queue
Browse files Browse the repository at this point in the history
  • Loading branch information
DieterHolvoet committed Jan 7, 2025
1 parent f5842cb commit d31ca65
Showing 1 changed file with 7 additions and 6 deletions.
13 changes: 7 additions & 6 deletions src/Commands/core/QueueCommands.php
Original file line number Diff line number Diff line change
Expand Up @@ -116,7 +116,8 @@ public function runAll($options = ['time-limit' => self::REQ, 'items-limit' => s
$worker = $this->getWorkerManager()->createInstance($name);
$lease_time = $options['lease-time'] ?? $info['cron']['time'] ?? 30;
$queue_starting = true;
$queue_count = 0;
$queue_start = microtime(true);
$queue_items_count = 0;

if ($queue instanceof QueueGarbageCollectionInterface) {
$queue->garbageCollection();
Expand All @@ -127,16 +128,16 @@ public function runAll($options = ['time-limit' => self::REQ, 'items-limit' => s
$this->logger()->notice('Processing queue ' . $name);
}
if ($this->processItem($queue, $worker, $name, $item)) {
$queue_count++;
$queue_items_count++;
}
$time_remaining = $end - time();
$queue_starting = false;
}

if ($queue_count > 0) {
$items_count += $queue_count;
$elapsed = microtime(true) - $start;
$this->logger()->success(dt('Processed @count items from the @name queue in @elapsed sec.', ['@count' => $queue_count, '@name' => $name, '@elapsed' => round($elapsed, 2)]));
if ($queue_items_count > 0) {
$items_count += $queue_items_count;
$elapsed = microtime(true) - $queue_start;
$this->logger()->success(dt('Processed @count items from the @name queue in @elapsed sec.', ['@count' => $queue_items_count, '@name' => $name, '@elapsed' => round($elapsed, 2)]));
}
}
if ($options['daemon']) {
Expand Down

0 comments on commit d31ca65

Please sign in to comment.