From 050688e155f3075b22d89aef97cc00912c3fb04f Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jan=20Lys=C3=BD?= Date: Fri, 21 May 2021 14:58:16 +0200 Subject: [PATCH] Schedule segments recalculation every day [MAILPOET-3633] --- lib/Cron/Workers/SubscribersEngagementScore.php | 2 +- lib/Segments/SegmentsRepository.php | 4 ++-- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/lib/Cron/Workers/SubscribersEngagementScore.php b/lib/Cron/Workers/SubscribersEngagementScore.php index 2898c83094..f65dce05ef 100644 --- a/lib/Cron/Workers/SubscribersEngagementScore.php +++ b/lib/Cron/Workers/SubscribersEngagementScore.php @@ -59,7 +59,7 @@ class SubscribersEngagementScore extends SimpleWorker { } private function recalculateSegments(): int { - $segments = $this->segmentsRepository->findByUpdatedScoreNotInLastMonth(self::BATCH_SIZE); + $segments = $this->segmentsRepository->findByUpdatedScoreNotInLastDay(self::BATCH_SIZE); foreach ($segments as $segment) { $this->statisticsOpensRepository->recalculateSegmentScore($segment); } diff --git a/lib/Segments/SegmentsRepository.php b/lib/Segments/SegmentsRepository.php index 19697ae67d..c8f6bfff21 100644 --- a/lib/Segments/SegmentsRepository.php +++ b/lib/Segments/SegmentsRepository.php @@ -185,8 +185,8 @@ class SegmentsRepository extends Repository { return $rows; } - public function findByUpdatedScoreNotInLastMonth(int $limit): array { - $dateTime = (new Carbon())->subMonths(1); + public function findByUpdatedScoreNotInLastDay(int $limit): array { + $dateTime = (new Carbon())->subDay(); return $this->entityManager->createQueryBuilder() ->select('s') ->from(SegmentEntity::class, 's')