fix: begin transaction before update domain

This commit is contained in:
Maël Gangloff
2024-12-30 17:40:52 +01:00
parent efbd055e1d
commit 88753273e1

View File

@@ -137,15 +137,15 @@ readonly class RDAPService
$rdapServer = $this->fetchRdapServer($tld); $rdapServer = $this->fetchRdapServer($tld);
$domain = $this->domainRepository->findOneBy(['ldhName' => $idnDomain]); $domain = $this->domainRepository->findOneBy(['ldhName' => $idnDomain]);
$this->em->beginTransaction();
$this->em->lock($domain, LockMode::PESSIMISTIC_WRITE);
$rdapData = $this->fetchRdapResponse($rdapServer, $idnDomain, $domain); $rdapData = $this->fetchRdapResponse($rdapServer, $idnDomain, $domain);
if (null === $domain) { if (null === $domain) {
$domain = $this->initNewDomain($idnDomain, $tld); $domain = $this->initNewDomain($idnDomain, $tld);
} }
$this->em->beginTransaction();
$this->em->lock($domain, LockMode::PESSIMISTIC_WRITE);
$this->updateDomainStatus($domain, $rdapData); $this->updateDomainStatus($domain, $rdapData);
if (in_array('free', $domain->getStatus())) { if (in_array('free', $domain->getStatus())) {