Skip to content

Commit 99dcf69

Browse files
committed
MAGE-938 Add cache clean up when deleting unused replica indices
1 parent 68e3228 commit 99dcf69

File tree

1 file changed

+13
-0
lines changed

1 file changed

+13
-0
lines changed

Service/Product/ReplicaManager.php

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -436,6 +436,10 @@ public function deleteReplicasFromAlgolia(int $storeId, bool $unused = false): v
436436
}
437437

438438
$this->deleteIndices($replicasToDelete);
439+
440+
if ($unused) {
441+
$this->clearUnusedReplicaIndicesCache($storeId);
442+
}
439443
}
440444

441445
/**
@@ -474,6 +478,15 @@ public function getUnusedReplicaIndices(int $storeId): array
474478
return $this->_unusedReplicaIndices[$storeId];
475479
}
476480

481+
protected function clearUnusedReplicaIndicesCache(?int $storeId = null): void
482+
{
483+
if (is_null($storeId)) {
484+
$this->_unusedReplicaIndices = [];
485+
} else {
486+
unset($this->_unusedReplicaIndices[$storeId]);
487+
}
488+
}
489+
477490
/**
478491
* Get a list of all replica indices for all Magento managed stores
479492
* (This may be useful in case of cross store replica misconfiguration)

0 commit comments

Comments
 (0)