Skip to content

Commit 6037378

Browse files
committed
MAGE-935 Clarify operations logged and return value intent
1 parent 333fa67 commit 6037378

File tree

1 file changed

+5
-4
lines changed

1 file changed

+5
-4
lines changed

Model/Product/ReplicaManager.php

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -204,7 +204,7 @@ public function handleReplicas(string $primaryIndexName, int $storeId, array $pr
204204
/**
205205
* @param $primaryIndexName
206206
* @param int $storeId
207-
* @return string[] Replicas added by this operation
207+
* @return string[] Replicas added or modified by this operation
208208
* @throws LocalizedException
209209
* @throws NoSuchEntityException
210210
* @throws AlgoliaException
@@ -219,9 +219,9 @@ protected function setReplicasOnPrimaryIndex($indexName, int $storeId): array
219219
$newMagentoReplicaIndices = $this->getBareIndexNamesFromReplicaSetting($newMagentoReplicasSetting);
220220

221221
$replicasToDelete = array_diff($oldMagentoReplicaIndices, $newMagentoReplicaIndices);
222-
$replicasToUpdate = array_diff($newMagentoReplicasSetting, $oldMagentoReplicasSetting);
223-
$replicasToUpdate = $this->getBareIndexNamesFromReplicaSetting($replicasToUpdate);
224222
$replicasToAdd = array_diff($newMagentoReplicaIndices, $oldMagentoReplicaIndices);
223+
$replicasToRank = $this->getBareIndexNamesFromReplicaSetting(array_diff($newMagentoReplicasSetting, $oldMagentoReplicasSetting));
224+
$replicasToUpdate = array_diff($replicasToRank, $replicasToAdd);
225225

226226
$this->algoliaHelper->setSettings(
227227
$indexName,
@@ -241,7 +241,8 @@ protected function setReplicasOnPrimaryIndex($indexName, int $storeId): array
241241
);
242242
}
243243

244-
return $replicasToUpdate;
244+
// include both added and updated replica indices
245+
return $replicasToRank;
245246
}
246247

247248
/**

0 commit comments

Comments
 (0)