@@ -204,7 +204,7 @@ public function handleReplicas(string $primaryIndexName, int $storeId, array $pr
204
204
/**
205
205
* @param $primaryIndexName
206
206
* @param int $storeId
207
- * @return string[] Replicas added by this operation
207
+ * @return string[] Replicas added or modified by this operation
208
208
* @throws LocalizedException
209
209
* @throws NoSuchEntityException
210
210
* @throws AlgoliaException
@@ -219,9 +219,9 @@ protected function setReplicasOnPrimaryIndex($indexName, int $storeId): array
219
219
$ newMagentoReplicaIndices = $ this ->getBareIndexNamesFromReplicaSetting ($ newMagentoReplicasSetting );
220
220
221
221
$ replicasToDelete = array_diff ($ oldMagentoReplicaIndices , $ newMagentoReplicaIndices );
222
- $ replicasToUpdate = array_diff ($ newMagentoReplicasSetting , $ oldMagentoReplicasSetting );
223
- $ replicasToUpdate = $ this ->getBareIndexNamesFromReplicaSetting ($ replicasToUpdate );
224
222
$ replicasToAdd = array_diff ($ newMagentoReplicaIndices , $ oldMagentoReplicaIndices );
223
+ $ replicasToRank = $ this ->getBareIndexNamesFromReplicaSetting (array_diff ($ newMagentoReplicasSetting , $ oldMagentoReplicasSetting ));
224
+ $ replicasToUpdate = array_diff ($ replicasToRank , $ replicasToAdd );
225
225
226
226
$ this ->algoliaHelper ->setSettings (
227
227
$ indexName ,
@@ -241,7 +241,8 @@ protected function setReplicasOnPrimaryIndex($indexName, int $storeId): array
241
241
);
242
242
}
243
243
244
- return $ replicasToUpdate ;
244
+ // include both added and updated replica indices
245
+ return $ replicasToRank ;
245
246
}
246
247
247
248
/**
0 commit comments