From 7d469df62ae5e65aa6a4ccf77d463d20b0ef6f1f Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Julien=20Fastr=C3=A9?= Date: Mon, 12 Dec 2022 21:17:03 +0100 Subject: [PATCH] Feature: CronJob for refreshing materialized view association between address and geographical unit --- ...shAddressToGeographicalUnitMaterializedViewCronJob.php | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/src/Bundle/ChillMainBundle/Service/AddressGeographicalUnit/RefreshAddressToGeographicalUnitMaterializedViewCronJob.php b/src/Bundle/ChillMainBundle/Service/AddressGeographicalUnit/RefreshAddressToGeographicalUnitMaterializedViewCronJob.php index a141f5100..a836f4124 100644 --- a/src/Bundle/ChillMainBundle/Service/AddressGeographicalUnit/RefreshAddressToGeographicalUnitMaterializedViewCronJob.php +++ b/src/Bundle/ChillMainBundle/Service/AddressGeographicalUnit/RefreshAddressToGeographicalUnitMaterializedViewCronJob.php @@ -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'))