Skip to content

Commit

Permalink
improve error handling
Browse files Browse the repository at this point in the history
  • Loading branch information
rliebi committed Dec 3, 2024
1 parent c5d658d commit 1e68611
Showing 1 changed file with 7 additions and 3 deletions.
10 changes: 7 additions & 3 deletions src/Command/Index.php
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@
use Symfony\Component\EventDispatcher\EventDispatcherInterface;
use Symfony\Component\Messenger\MessageBusInterface;
use Valantic\ElasticaBridgeBundle\Constant\CommandConstants;
use Valantic\ElasticaBridgeBundle\Exception\Index\PopulationNotStartedException;
use Valantic\ElasticaBridgeBundle\Messenger\Message\PopulateIndexMessage;
use Valantic\ElasticaBridgeBundle\Model\Event\ElasticaBridgeEvents;
use Valantic\ElasticaBridgeBundle\Model\Event\PreExecuteEvent;
Expand Down Expand Up @@ -90,10 +91,13 @@ protected function execute(InputInterface $input, OutputInterface $output): int

$this->eventDispatcher->dispatch(new PreExecuteEvent($indexConfig, PreExecuteEvent::SOURCE_CLI), ElasticaBridgeEvents::PRE_EXECUTE);

foreach ($this->populateIndexService->triggerSingleIndex($indexConfig, $populate, $lockRelease, $noCooldown) as $message) {
if ($message instanceof PopulateIndexMessage) {
$this->messengerBusElasticaBridge->dispatch($message->message);
try {
foreach ($this->populateIndexService->triggerSingleIndex($indexConfig, $populate, $lockRelease, $noCooldown) as $message) {
if ($message instanceof PopulateIndexMessage) {
$this->messengerBusElasticaBridge->dispatch($message->message);
}
}
} catch (PopulationNotStartedException) {
}
}

Expand Down

0 comments on commit 1e68611

Please sign in to comment.