Skip to content

Commit

Permalink
Fix chunk producer (TheSoftwareHouse#10)
Browse files Browse the repository at this point in the history
  • Loading branch information
ajmahoney authored Jun 16, 2020
1 parent be8b5a6 commit d1fb150
Showing 1 changed file with 4 additions and 4 deletions.
8 changes: 4 additions & 4 deletions src/Fogger/Data/ChunkProducer.php
Original file line number Diff line number Diff line change
Expand Up @@ -43,24 +43,24 @@ private function queueTableChunks(Table $table)

$counter = 0;
$keys = [];
$last_key = null;

while (($key = $result->fetchColumn()) !== False) {
$keys[] = $key;
$counter++;

if (0 === $counter % $table->getChunkSize()) {
$last_key = null;

$this->chunkCache->pushMessage($table, $keys);

do {
$last_key = $key;
$key = $result->fetchColumn();
$counter++;
} while ($last_key === $key);

$this->chunkCache->pushMessage($table, $keys);
$keys = [];
$keys[] = $key;
}
$last_key = $key;
}
if (0 !== $counter % $table->getChunkSize()) {
$this->chunkCache->pushMessage($table, $keys);
Expand Down

0 comments on commit d1fb150

Please sign in to comment.