Merge pull request #65 from Codappix/feature/allow-exchange-of-limit

TASK: Allow sub indexer to exchange limit
This commit is contained in:
Daniel Siepmann 2017-07-27 14:28:04 +02:00 committed by GitHub
commit 324137711e

View file

@ -83,8 +83,7 @@ abstract class AbstractIndexer implements IndexerInterface
protected function getRecordGenerator() protected function getRecordGenerator()
{ {
$offset = 0; $offset = 0;
// TODO: Make configurable. $limit = $this->getLimit();
$limit = 50;
while (($records = $this->getRecords($offset, $limit)) !== []) { while (($records = $this->getRecords($offset, $limit)) !== []) {
yield $records; yield $records;
@ -92,6 +91,17 @@ abstract class AbstractIndexer implements IndexerInterface
} }
} }
/**
* Returns the limit to use to fetch records.
*
* @return int
*/
protected function getLimit()
{
// TODO: Make configurable.
return 50;
}
/** /**
* @param int $offset * @param int $offset
* @param int $limit * @param int $limit