Feature: CronJob for refreshing materialized view association between address and geographical unit

This commit is contained in:
2022-12-12 21:17:03 +01:00
parent 204ebd4415
commit 7d469df62a

View File

@@ -32,14 +32,14 @@ class RefreshAddressToGeographicalUnitMaterializedViewCronJob implements CronJob
public function canRun(?CronJobExecution $cronJobExecution): bool
{
if ($cronJobExecution->getKey() !== $this->getKey()) {
throw new UnexpectedValueException();
}
if (null === $cronJobExecution) {
return true;
}
if ($cronJobExecution->getKey() !== $this->getKey()) {
throw new UnexpectedValueException();
}
$now = new DateTimeImmutable('now');
return $cronJobExecution->getLastStart() < $now->sub(new DateInterval('P1D'))