Skip to content

Commit c1aab3a

Browse files
authored
Merge pull request #418 from gradinarufelix/bugfix-retry-on-conflict-in-fulltext-update
BUGFIX: Retry on conflict also in fulltext method and make number of retries configurable
2 parents 7010f1d + 764de93 commit c1aab3a

2 files changed

Lines changed: 10 additions & 2 deletions

File tree

Classes/Driver/Version6/IndexerDriver.php

Lines changed: 9 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -29,6 +29,11 @@
2929
*/
3030
class IndexerDriver extends AbstractIndexerDriver implements IndexerDriverInterface
3131
{
32+
/**
33+
* @Flow\InjectConfiguration(path="indexing.retryOnConflict")
34+
* @var int
35+
*/
36+
protected $retryOnConflict = 3;
3237

3338
#[Flow\Inject]
3439
protected ContentRepositoryRegistry $contentRepositoryRegistry;
@@ -47,7 +52,7 @@ public function document(string $indexName, Node $node, ElasticSearchDocument $d
4752
'update' => [
4853
'_id' => $document->getId(),
4954
'_index' => $indexName,
50-
'retry_on_conflict' => 3
55+
'retry_on_conflict' => $this->retryOnConflict ?: 3
5156
]
5257
],
5358
// https://www.elastic.co/guide/en/elasticsearch/reference/5.0/docs-update.html
@@ -75,6 +80,7 @@ public function document(string $indexName, Node $node, ElasticSearchDocument $d
7580
'index' => [
7681
'_id' => $document->getId(),
7782
'_index' => $indexName,
83+
'retry_on_conflict' => $this->retryOnConflict ?: 3
7884
]
7985
],
8086
$documentData
@@ -105,7 +111,8 @@ public function fulltext(Node $node, array $fulltextIndexOfNode, ?WorkspaceName
105111
return [
106112
[
107113
'update' => [
108-
'_id' => $closestFulltextNodeDocumentIdentifier
114+
'_id' => $closestFulltextNodeDocumentIdentifier,
115+
'retry_on_conflict' => $this->retryOnConflict ?: 3
109116
]
110117
],
111118
// https://www.elastic.co/guide/en/elasticsearch/reference/current/docs-update.html

Configuration/Settings.yaml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,7 @@ Flowpack:
44
command:
55
useSubProcesses: true
66
indexing:
7+
retryOnConflict: 3
78
batchSize:
89
elements: 500
910
octets: 40000000

0 commit comments

Comments
 (0)