Add check that item cache contains created_at

[MAILPOET-3646]
This commit is contained in:
Jan Lysý
2021-07-02 15:17:06 +02:00
committed by Veljko V
parent 9f9706e319
commit bd49e73efb

View File

@@ -53,7 +53,7 @@ class SubscribersCountCacheRecalculation extends SimpleWorker {
$this->cronHelper->enforceExecutionLimit($timer);
$now = Carbon::now();
$item = $this->transientCache->getItem(TransientCache::SUBSCRIBERS_STATISTICS_COUNT_KEY, $segmentId);
if ($item === null || $now->diffInMinutes($item['created_at']) > self::EXPIRATION_IN_MINUTES) {
if ($item === null || !isset($item['created_at']) || $now->diffInMinutes($item['created_at']) > self::EXPIRATION_IN_MINUTES) {
$this->transientCache->invalidateItem(TransientCache::SUBSCRIBERS_STATISTICS_COUNT_KEY, $segmentId);
if ($segment) {
$this->segmentSubscribersRepository->getSubscribersStatisticsCount($segment);