getUser()->getUserIdentifier(); $this->logger->info('User {username} wants to update the domain name {idnDomain}.', [ 'username' => $userId, 'idnDomain' => $idnDomain, ]); /** @var ?Domain $domain */ $domain = $this->domainRepository->findOneBy(['ldhName' => $idnDomain]); // If the domain name exists in the database, recently updated and not important, we return the stored Domain if (null !== $domain && !$domain->getDeleted() && !$domain->isToBeUpdated() && !$this->kernel->isDebug() ) { $this->logger->info('It is not necessary to update the information of the domain name {idnDomain} with the RDAP protocol.', [ 'idnDomain' => $idnDomain, ]); return $domain; } if (false === $kernel->isDebug() && true === $this->getParameter('limited_features')) { $limiter = $this->rdapRequestsLimiter->create($userId); $limit = $limiter->consume(); if (!$limit->isAccepted()) { throw new TooManyRequestsHttpException($limit->getRetryAfter()->getTimestamp() - time()); } } $updatedAt = null === $domain ? new \DateTimeImmutable('now') : $domain->getUpdatedAt(); $domain = $this->RDAPService->registerDomain($idnDomain); $randomizer = new Randomizer(); $watchLists = $randomizer->shuffleArray($domain->getWatchLists()->toArray()); /** @var WatchList $watchList */ foreach ($watchLists as $watchList) { $this->bus->dispatch(new SendDomainEventNotif($watchList->getToken(), $domain->getLdhName(), $updatedAt)); } return $domain; } }