Removed transactionality when dispatching async events, as they run in different processes with different db connections

This commit is contained in:
Alejandro Celaya
2021-10-23 13:22:42 +02:00
parent 6f62d62909
commit c7a621cb31
7 changed files with 26 additions and 18 deletions

View File

@@ -69,11 +69,9 @@ class VisitsTracker implements VisitsTrackerInterface
}
$visit = $createVisit($visitor->normalizeForTrackingOptions($this->options));
$this->em->transactional(function () use ($visit, $visitor): void {
$this->em->persist($visit);
$this->em->flush();
$this->em->persist($visit);
$this->em->flush();
$this->eventDispatcher->dispatch(new UrlVisited($visit->getId(), $visitor->getRemoteAddress()));
});
$this->eventDispatcher->dispatch(new UrlVisited($visit->getId(), $visitor->getRemoteAddress()));
}
}