Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
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)
  • Loading branch information
Anton Evers authored and vpodorozh committed Oct 27, 2018
1 parent 2539a71 commit 76bd089
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 3 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -107,7 +107,7 @@ public function __construct(
public function current()
{
if (null === $this->currentSelect) {
$this->isValid = ($this->currentOffset + $this->batchSize) <= $this->totalItemCount;
$this->isValid = $this->currentOffset < $this->totalItemCount;
$this->currentSelect = $this->initSelectObject();
}
return $this->currentSelect;
Expand Down Expand Up @@ -138,7 +138,7 @@ public function next()
if (null === $this->currentSelect) {
$this->current();
}
$this->isValid = ($this->batchSize + $this->currentOffset) <= $this->totalItemCount;
$this->isValid = $this->currentOffset < $this->totalItemCount;
$select = $this->initSelectObject();
if ($this->isValid) {
$this->iteration++;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -116,6 +116,6 @@ public function testIterations()
$iterations++;
}

$this->assertEquals(10, $iterations);
$this->assertEquals(11, $iterations);
}
}

0 comments on commit 76bd089

Please sign in to comment.