Skip to content

Commit

Permalink
use opensearch exception
Browse files Browse the repository at this point in the history
  • Loading branch information
AlternateIf committed Dec 2, 2024
1 parent 41f1bb7 commit d44445f
Showing 1 changed file with 4 additions and 2 deletions.
6 changes: 4 additions & 2 deletions src/IndexService/Worker/OpenSearch/AbstractOpenSearch.php
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,8 @@

use Doctrine\DBAL\Connection;
use Exception;
use OpenSearch\Common\Exceptions\OpenSearchException;
use OpenSearch\Common\Exceptions\RequestTimeout408Exception;
use OpenSearch\Client;
use Pimcore\Bundle\EcommerceFrameworkBundle\IndexService\Config\OpenSearch;
use Pimcore\Bundle\EcommerceFrameworkBundle\IndexService\Config\SearchConfigInterface;
Expand Down Expand Up @@ -871,7 +873,7 @@ protected function getNextIndexVersion(): int
* @param string $sourceIndexName the name of the source index in ES.
* @param string $targetIndexName the name of the target index in ES. If existing, will be deleted
*
* @throws \OpenSearch\Common\Exceptions\OpenSearchException
* @throws OpenSearchException
*/
protected function performReindex(string $sourceIndexName, string $targetIndexName): void
{
Expand Down Expand Up @@ -926,7 +928,7 @@ protected function performReindex(string $sourceIndexName, string $targetIndexNa
}

if ($taskResponse === null || !isset($taskResponse['completed']) || $taskResponse['completed'] === false) {

Check failure on line 930 in src/IndexService/Worker/OpenSearch/AbstractOpenSearch.php

View workflow job for this annotation

GitHub Actions / Static Analysis with PHPStan (8.1, lowest, false)

Strict comparison using === between array and null will always evaluate to false.

Check failure on line 930 in src/IndexService/Worker/OpenSearch/AbstractOpenSearch.php

View workflow job for this annotation

GitHub Actions / Static Analysis with PHPStan (8.2, highest, false)

Strict comparison using === between array and null will always evaluate to false.

Check failure on line 930 in src/IndexService/Worker/OpenSearch/AbstractOpenSearch.php

View workflow job for this annotation

GitHub Actions / Static Analysis with PHPStan (8.3, highest, false)

Strict comparison using === between array and null will always evaluate to false.
throw new \OpenSearch\Common\Exceptions\RequestTimeout408Exception('reindex is not finished. Cleanup task index for task ' . $taskId);
throw new RequestTimeout408Exception('reindex is not finished. Cleanup task index for task ' . $taskId);
}

Logger::info(sprintf('Completed re-index in %.02f seconds.', (time() - $startTime)));
Expand Down

0 comments on commit d44445f

Please sign in to comment.