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->getUpdatedAt()->diff(new \DateTimeImmutable('now'))->days < 7) && !$this->RDAPService::isToBeWatchClosely($domain, $domain->getUpdatedAt()) ) { $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); try { $limiter->consume()->ensureAccepted(); } catch (RateLimitExceededException $e) { throw new TooManyRequestsHttpException($e->getRetryAfter()->getTimestamp() - time(), $e->getMessage()); } } $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 ProcessDomainTrigger($watchList->getToken(), $domain->getLdhName(), $updatedAt)); } return $domain; } }