Skip to content

Commit db61678

Browse files
authored
Merge pull request #17 from kitsunet/feature/configurable-batch-size
FEATURE: Make batch size configurable
2 parents a1b9ca5 + d7beec6 commit db61678

File tree

2 files changed

+10
-2
lines changed

2 files changed

+10
-2
lines changed

Classes/Command/NodeIndexQueueCommandController.php

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -26,6 +26,7 @@ class NodeIndexQueueCommandController extends CommandController
2626

2727
const BATCH_QUEUE_NAME = 'Flowpack.ElasticSearch.ContentRepositoryQueueIndexer';
2828
const LIVE_QUEUE_NAME = 'Flowpack.ElasticSearch.ContentRepositoryQueueIndexer.Live';
29+
const DEFAULT_BATCH_SIZE = 500;
2930

3031
/**
3132
* @var JobManager
@@ -69,6 +70,12 @@ class NodeIndexQueueCommandController extends CommandController
6970
*/
7071
protected $nodeIndexer;
7172

73+
/**
74+
* @Flow\InjectConfiguration(package="Flowpack.ElasticSearch.ContentRepositoryQueueIndexer")
75+
* @var array
76+
*/
77+
protected $settings;
78+
7279
/**
7380
* Index all nodes by creating a new index and when everything was completed, switch the index alias.
7481
*
@@ -210,7 +217,7 @@ protected function indexWorkspace($workspaceName, $indexPostfix)
210217
$this->outputLine('<info>++</info> Indexing %s workspace', [$workspaceName]);
211218
$nodeCounter = 0;
212219
$offset = 0;
213-
$batchSize = 500;
220+
$batchSize = $this->settings['batchSize'] ?? static::DEFAULT_BATCH_SIZE;
214221
while (true) {
215222
$iterator = $this->nodeDataRepository->findAllBySiteAndWorkspace($workspaceName, $offset, $batchSize);
216223

Configuration/Settings.yaml

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,8 @@ Flowpack:
22
ElasticSearch:
33
ContentRepositoryQueueIndexer:
44
enableLiveAsyncIndexing: true
5-
5+
# Change size of single batch jobs via this setting (fallback default is 500)
6+
# batchSize: 50
67
JobQueue:
78
Common:
89
queues:

0 commit comments

Comments
 (0)