diff --git a/packages/seal-algolia-adapter/bin/drop_all_indexes.php b/packages/seal-algolia-adapter/bin/drop_all_indexes.php index 04c383fc..770481f0 100755 --- a/packages/seal-algolia-adapter/bin/drop_all_indexes.php +++ b/packages/seal-algolia-adapter/bin/drop_all_indexes.php @@ -34,9 +34,22 @@ $client = \Schranz\Search\SEAL\Adapter\Algolia\Tests\ClientHelper::getClient(); $return = 0; + +$retryIndexes = []; foreach ($client->listIndices()['items'] as $key => $value) { echo 'Delete ... ' . $value['name'] . \PHP_EOL; + try { + $client->deleteIndex($value['name']); + } catch (\Exception) { + $retryIndexes[$key] = $value; + echo 'Retry later ... ' . $value['name'] . \PHP_EOL; + } +} + +foreach ($retryIndexes as $key => $value) { + echo 'Delete ... ' . $value['name'] . \PHP_EOL; + try { $client->deleteIndex($value['name']); } catch (\Exception) {