Skip to content

Commit f540485

Browse files
committed
Only start progress bar if any queue items
1 parent 18a4782 commit f540485

File tree

1 file changed

+7
-2
lines changed

1 file changed

+7
-2
lines changed

src/Commands/core/QueueCommands.php

+7-2
Original file line numberDiff line numberDiff line change
@@ -98,7 +98,10 @@ public function run(string $name, $options = ['time-limit' => self::REQ, 'items-
9898
$queue->garbageCollection();
9999
}
100100

101-
$this->io()->progressStart($items_limit ?: $queue->numberOfItems());
101+
$max = $items_limit ?: $queue->numberOfItems();
102+
if ($max > 0) {
103+
$this->io()->progressStart($max);
104+
}
102105

103106
while ((!$time_limit || $remaining > 0) && (!$items_limit || $count < $items_limit) && ($item = $queue->claimItem($lease_time))) {
104107
try {
@@ -134,7 +137,9 @@ public function run(string $name, $options = ['time-limit' => self::REQ, 'items-
134137
$remaining = $end - time();
135138
}
136139
$elapsed = microtime(true) - $start;
137-
$this->io()->progressFinish();
140+
if ($max > 0) {
141+
$this->io()->progressFinish();
142+
}
138143
$this->logger()->success(dt('Processed @count items from the @name queue in @elapsed sec.', ['@count' => $count, '@name' => $name, '@elapsed' => round($elapsed, 2)]));
139144
}
140145

0 commit comments

Comments
 (0)