mirror of
https://github.com/maelgangloff/domain-watchdog.git
synced 2025-12-29 16:15:04 +00:00
fix: begin transaction before update domain
This commit is contained in:
@@ -23,6 +23,7 @@ use App\Repository\NameserverEntityRepository;
|
|||||||
use App\Repository\NameserverRepository;
|
use App\Repository\NameserverRepository;
|
||||||
use App\Repository\RdapServerRepository;
|
use App\Repository\RdapServerRepository;
|
||||||
use App\Repository\TldRepository;
|
use App\Repository\TldRepository;
|
||||||
|
use Doctrine\DBAL\LockMode;
|
||||||
use Doctrine\ORM\EntityManagerInterface;
|
use Doctrine\ORM\EntityManagerInterface;
|
||||||
use Doctrine\ORM\Exception\ORMException;
|
use Doctrine\ORM\Exception\ORMException;
|
||||||
use Psr\Log\LoggerInterface;
|
use Psr\Log\LoggerInterface;
|
||||||
@@ -136,6 +137,9 @@ 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) {
|
||||||
@@ -160,6 +164,7 @@ readonly class RDAPService
|
|||||||
|
|
||||||
$this->em->persist($domain);
|
$this->em->persist($domain);
|
||||||
$this->em->flush();
|
$this->em->flush();
|
||||||
|
$this->em->commit();
|
||||||
|
|
||||||
return $domain;
|
return $domain;
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user