Skip to content

Commit

Permalink
fix(symfony): detach objects from store to prevent infinite loop duri…
Browse files Browse the repository at this point in the history
…ng premature flush before all objects updates are published and stores are reset (#6936)
  • Loading branch information
LaurentHuzard committed Feb 12, 2025
1 parent 421d97e commit 73e5ff6
Showing 1 changed file with 5 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -238,6 +238,11 @@ private function publishUpdate(object $object, array $options, string $type): vo

$updates = array_merge([$this->buildUpdate($iri, $data, $options)], $this->getGraphQlSubscriptionUpdates($object, $options, $type));

// Detach objects to prevent infinite loops in case a flush occurs before all updates are published and the store is reset
$this->updatedObjects->detach($object);
$this->createdObjects->detach($object);
$this->deletedObjects->detach($object);

Check warning on line 244 in src/Symfony/Doctrine/EventListener/PublishMercureUpdatesListener.php

View check run for this annotation

Codecov / codecov/patch

src/Symfony/Doctrine/EventListener/PublishMercureUpdatesListener.php#L242-L244

Added lines #L242 - L244 were not covered by tests

foreach ($updates as $update) {
if ($options['enable_async_update'] && $this->messageBus) {
$this->dispatch($update);
Expand Down

0 comments on commit 73e5ff6

Please sign in to comment.