From efbd055e1dfd0bb941e7cb311ceec7dcd294cf5e Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Ma=C3=ABl=20Gangloff?= Date: Mon, 30 Dec 2024 17:19:07 +0100 Subject: [PATCH] fix: begin transaction before update domain --- src/Service/RDAPService.php | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/src/Service/RDAPService.php b/src/Service/RDAPService.php index 795d610..dadd1a3 100644 --- a/src/Service/RDAPService.php +++ b/src/Service/RDAPService.php @@ -23,6 +23,7 @@ use App\Repository\NameserverEntityRepository; use App\Repository\NameserverRepository; use App\Repository\RdapServerRepository; use App\Repository\TldRepository; +use Doctrine\DBAL\LockMode; use Doctrine\ORM\EntityManagerInterface; use Doctrine\ORM\Exception\ORMException; use Psr\Log\LoggerInterface; @@ -136,6 +137,9 @@ readonly class RDAPService $rdapServer = $this->fetchRdapServer($tld); $domain = $this->domainRepository->findOneBy(['ldhName' => $idnDomain]); + $this->em->beginTransaction(); + $this->em->lock($domain, LockMode::PESSIMISTIC_WRITE); + $rdapData = $this->fetchRdapResponse($rdapServer, $idnDomain, $domain); if (null === $domain) { @@ -160,6 +164,7 @@ readonly class RDAPService $this->em->persist($domain); $this->em->flush(); + $this->em->commit(); return $domain; }