Schedule segments recalculation every day
[MAILPOET-3633]
This commit is contained in:
@ -59,7 +59,7 @@ class SubscribersEngagementScore extends SimpleWorker {
|
|||||||
}
|
}
|
||||||
|
|
||||||
private function recalculateSegments(): int {
|
private function recalculateSegments(): int {
|
||||||
$segments = $this->segmentsRepository->findByUpdatedScoreNotInLastMonth(self::BATCH_SIZE);
|
$segments = $this->segmentsRepository->findByUpdatedScoreNotInLastDay(self::BATCH_SIZE);
|
||||||
foreach ($segments as $segment) {
|
foreach ($segments as $segment) {
|
||||||
$this->statisticsOpensRepository->recalculateSegmentScore($segment);
|
$this->statisticsOpensRepository->recalculateSegmentScore($segment);
|
||||||
}
|
}
|
||||||
|
@ -185,8 +185,8 @@ class SegmentsRepository extends Repository {
|
|||||||
return $rows;
|
return $rows;
|
||||||
}
|
}
|
||||||
|
|
||||||
public function findByUpdatedScoreNotInLastMonth(int $limit): array {
|
public function findByUpdatedScoreNotInLastDay(int $limit): array {
|
||||||
$dateTime = (new Carbon())->subMonths(1);
|
$dateTime = (new Carbon())->subDay();
|
||||||
return $this->entityManager->createQueryBuilder()
|
return $this->entityManager->createQueryBuilder()
|
||||||
->select('s')
|
->select('s')
|
||||||
->from(SegmentEntity::class, 's')
|
->from(SegmentEntity::class, 's')
|
||||||
|
Reference in New Issue
Block a user