Skip to content

Commit

Permalink
fix(SearchEngine): Do no trigger error on Solr messages if Solr is no…
Browse files Browse the repository at this point in the history
…t available
  • Loading branch information
ambroisemaupate committed Jul 25, 2022
1 parent 3a381eb commit 785c559
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 0 deletions.
3 changes: 3 additions & 0 deletions src/SearchEngine/Message/Handler/SolrDeleteMessageHandler.php
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@
namespace RZ\Roadiz\CoreBundle\SearchEngine\Message\Handler;

use Psr\Log\LoggerInterface;
use RZ\Roadiz\CoreBundle\Exception\SolrServerNotAvailableException;
use RZ\Roadiz\CoreBundle\SearchEngine\Indexer\IndexerFactoryInterface;
use RZ\Roadiz\CoreBundle\SearchEngine\Message\SolrDeleteMessage;
use Symfony\Component\Messenger\Handler\MessageHandlerInterface;
Expand All @@ -30,6 +31,8 @@ public function __invoke(SolrDeleteMessage $message)
if (!empty($message->getIdentifier())) {
$this->indexerFactory->getIndexerFor($message->getClassname())->delete($message->getIdentifier());
}
} catch (SolrServerNotAvailableException $exception) {
return;
} catch (\LogicException $exception) {
$this->logger->error($exception->getMessage());
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@
namespace RZ\Roadiz\CoreBundle\SearchEngine\Message\Handler;

use Psr\Log\LoggerInterface;
use RZ\Roadiz\CoreBundle\Exception\SolrServerNotAvailableException;
use RZ\Roadiz\CoreBundle\SearchEngine\Indexer\IndexerFactoryInterface;
use RZ\Roadiz\CoreBundle\SearchEngine\Message\SolrReindexMessage;
use Symfony\Component\Messenger\Handler\MessageHandlerInterface;
Expand All @@ -30,6 +31,8 @@ public function __invoke(SolrReindexMessage $message)
if (!empty($message->getIdentifier())) {
$this->indexerFactory->getIndexerFor($message->getClassname())->index($message->getIdentifier());
}
} catch (SolrServerNotAvailableException $exception) {
return;
} catch (\LogicException $exception) {
$this->logger->error($exception->getMessage());
}
Expand Down

0 comments on commit 785c559

Please sign in to comment.