Skip to content

Commit 76bd089

Browse files
Anton Eversvpodorozh
authored andcommitted
catalog:images:resize fails to process all images -> Possible underlying Magento/Framework/DB/Query/Generator issue Ranged selects always miss the last range Fix unit test. 11 batches expected to handle 105 items: 1: 1-10 2: 11-20 3: 21-30 4: 31-40 5: 41-50 6: 51-60 7: 61-70 8: 71-80 9: 81-90 10: 91-100 11: 101-105 (cherry picked from commit 6c24c0e)
1 parent 2539a71 commit 76bd089

File tree

2 files changed

+3
-3
lines changed

2 files changed

+3
-3
lines changed

lib/internal/Magento/Framework/DB/Query/BatchRangeIterator.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -107,7 +107,7 @@ public function __construct(
107107
public function current()
108108
{
109109
if (null === $this->currentSelect) {
110-
$this->isValid = ($this->currentOffset + $this->batchSize) <= $this->totalItemCount;
110+
$this->isValid = $this->currentOffset < $this->totalItemCount;
111111
$this->currentSelect = $this->initSelectObject();
112112
}
113113
return $this->currentSelect;
@@ -138,7 +138,7 @@ public function next()
138138
if (null === $this->currentSelect) {
139139
$this->current();
140140
}
141-
$this->isValid = ($this->batchSize + $this->currentOffset) <= $this->totalItemCount;
141+
$this->isValid = $this->currentOffset < $this->totalItemCount;
142142
$select = $this->initSelectObject();
143143
if ($this->isValid) {
144144
$this->iteration++;

lib/internal/Magento/Framework/Test/Unit/DB/Query/BatchRangeIteratorTest.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -116,6 +116,6 @@ public function testIterations()
116116
$iterations++;
117117
}
118118

119-
$this->assertEquals(10, $iterations);
119+
$this->assertEquals(11, $iterations);
120120
}
121121
}

0 commit comments

Comments
 (0)