Skip to content

Commit 8a131a3

Browse files
bencrokerbrandonkelly
authored andcommitted
Update BaseBatchedJob.php
1 parent 7120222 commit 8a131a3

1 file changed

Lines changed: 5 additions & 4 deletions

File tree

src/queue/BaseBatchedJob.php

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -115,17 +115,18 @@ final protected function totalBatches(): int
115115
public function execute($queue): void
116116
{
117117
$items = $this->data()->getSlice($this->itemOffset, $this->batchSize);
118-
$totalInBatch = is_array($items) ? count($items) : iterator_count($items);
119118

120119
$memoryLimit = ConfigHelper::sizeInBytes(ini_get('memory_limit'));
121120
$startMemory = $memoryLimit != -1 ? memory_get_usage() : null;
122121

123122
$i = 0;
124123

125124
foreach ($items as $item) {
126-
$this->setProgress($queue, $i / $totalInBatch, Translation::prep('app', '{step, number} of {total, number}', [
127-
'step' => $this->itemOffset + 1,
128-
'total' => $this->totalItems(),
125+
$step = $this->itemOffset + 1;
126+
$total = $this->totalItems();
127+
$this->setProgress($queue, $step / $total, Translation::prep('app', '{step, number} of {total, number}', [
128+
'step' => $step,
129+
'total' => $total,
129130
]));
130131
$this->processItem($item);
131132
$this->itemOffset++;

0 commit comments

Comments
 (0)