TASK: Allow sub indexer to exchange limit

As long as it's not configurable, allow concrete implementations to
exchange. Necessary for one customer at the moment.
This commit is contained in:
Daniel Siepmann 2017-07-20 09:48:44 +02:00
parent c58e13cdf6
commit b832a6e6b3
Signed by: Daniel Siepmann
GPG key ID: 33D6629915560EF4

View file

@ -83,8 +83,7 @@ abstract class AbstractIndexer implements IndexerInterface
protected function getRecordGenerator()
{
$offset = 0;
// TODO: Make configurable.
$limit = 50;
$limit = $this->getLimit();
while (($records = $this->getRecords($offset, $limit)) !== []) {
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 $limit