fix: switch updatedAt to datetime_immutable

This commit is contained in:
Maël Gangloff
2024-09-04 18:33:02 +02:00
parent b4aef61de2
commit 71173306d6
6 changed files with 40 additions and 7 deletions

View File

@@ -54,7 +54,7 @@ class DomainRefreshController extends AbstractController
if (null !== $domain
&& !$domain->getDeleted()
&& ($domain->getUpdatedAt()->diff(new \DateTimeImmutable('now'))->days < 7)
&& !$this->RDAPService::isToBeWatchClosely($domain, $domain->getUpdatedAt())
&& !$this->RDAPService::isToBeWatchClosely($domain)
&& !$this->kernel->isDebug()
) {
$this->logger->info('It is not necessary to update the information of the domain name {idnDomain} with the RDAP protocol.', [

View File

@@ -90,10 +90,10 @@ class Domain
private Collection $nameservers;
#[ORM\Column(type: Types::DATE_IMMUTABLE)]
private ?\DateTimeImmutable $createdAt = null;
private ?\DateTimeImmutable $createdAt;
#[ORM\Column(type: Types::DATE_IMMUTABLE)]
private ?\DateTimeImmutable $updatedAt = null;
#[ORM\Column(type: Types::DATETIME_IMMUTABLE)]
private ?\DateTimeImmutable $updatedAt;
#[ORM\ManyToOne]
#[ORM\JoinColumn(referencedColumnName: 'tld', nullable: false)]

View File

@@ -65,7 +65,7 @@ final readonly class UpdateDomainsFromWatchlistHandler
->filter(fn ($domain) => $domain->getUpdatedAt()
->diff(
new \DateTimeImmutable('now'))->days >= 7
|| $this->RDAPService::isToBeWatchClosely($domain, $domain->getUpdatedAt())
|| $this->RDAPService::isToBeWatchClosely($domain)
) as $domain
) {
$updatedAt = $domain->getUpdatedAt();

View File

@@ -21,7 +21,7 @@ final readonly class SendNotifWatchListTriggerSchedule implements ScheduleProvid
{
return (new Schedule())
->add(
RecurringMessage::every('1 day', new ProcessWatchListsTrigger()),
RecurringMessage::every('1 hour', new ProcessWatchListsTrigger()),
)
->stateful($this->cache);
}

View File

@@ -99,7 +99,7 @@ readonly class RDAPService
*
* @throws \Exception
*/
public static function isToBeWatchClosely(Domain $domain, \DateTimeImmutable $updatedAt): bool
public static function isToBeWatchClosely(Domain $domain): bool
{
$status = $domain->getStatus();
if (!empty($status) && count(array_intersect($status, self::IMPORTANT_STATUS))) {