Skip to content

Commit bc8ee3d

Browse files
authored
Duplicate Replica Issue one set is standard and another is virtual
1 parent b7d6434 commit bc8ee3d

File tree

1 file changed

+4
-2
lines changed

1 file changed

+4
-2
lines changed

Helper/Entity/ProductHelper.php

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1558,12 +1558,14 @@ public function handlingReplica($indexName, $storeId, $sortingAttribute = false)
15581558
return $sortingIndex['name'];
15591559
}, $sortingIndices));
15601560
try {
1561+
$replicasFormated = $this->handleVirtualReplica($replicas);
1562+
$availableReplicaMatch = array_merge($replicasFormated, $replicas);
15611563
if ($this->configHelper->useVirtualReplica($storeId)) {
1562-
$replicas = $this->handleVirtualReplica($replicas, $indexName);
1564+
$replicas = $replicasFormated;
15631565
}
15641566
$currentSettings = $this->algoliaHelper->getSettings($indexName);
15651567
if (is_array($currentSettings) && array_key_exists('replicas', $currentSettings)) {
1566-
$replicasRequired = array_values(array_diff_assoc($currentSettings['replicas'], $replicas));
1568+
$replicasRequired = array_values(array_diff($currentSettings['replicas'], $availableReplicaMatch));
15671569
$this->algoliaHelper->setSettings($indexName, ['replicas' => $replicasRequired]);
15681570
$setReplicasTaskId = $this->algoliaHelper->getLastTaskId();
15691571
$this->algoliaHelper->waitLastTask($indexName, $setReplicasTaskId);

0 commit comments

Comments
 (0)