diff --git a/lib/Cron/Workers/StatsNotifications/AutomatedEmails.php b/lib/Cron/Workers/StatsNotifications/AutomatedEmails.php index 6fe6687401..4822f07d6c 100644 --- a/lib/Cron/Workers/StatsNotifications/AutomatedEmails.php +++ b/lib/Cron/Workers/StatsNotifications/AutomatedEmails.php @@ -116,7 +116,7 @@ class AutomatedEmails extends SimpleWorker { protected function getNewsletters() { $result = []; - $newsletters = $this->repository->getDueAutomatedNewsletters(); + $newsletters = $this->repository->findScheduledAutomatedNewsletters(); foreach ($newsletters as $newsletter) { $statistics = $this->newsletter_statistics_repository->getStatistics($newsletter); if ($statistics->getTotalSentCount()) { diff --git a/lib/Cron/Workers/StatsNotifications/StatsNotificationsRepository.php b/lib/Cron/Workers/StatsNotifications/StatsNotificationsRepository.php index be28ae31b7..808509c417 100644 --- a/lib/Cron/Workers/StatsNotifications/StatsNotificationsRepository.php +++ b/lib/Cron/Workers/StatsNotifications/StatsNotificationsRepository.php @@ -31,7 +31,7 @@ class StatsNotificationsRepository extends Repository { * @param int|null $limit * @return StatsNotificationEntity[] */ - public function findDueTasks($limit = null) { + public function findScheduled($limit = null) { $date = new Carbon(); $query = $this->doctrine_repository ->createQueryBuilder('stn') @@ -57,7 +57,7 @@ class StatsNotificationsRepository extends Repository { /** * @return NewsletterEntity[] */ - public function getDueAutomatedNewsletters() { + public function findScheduledAutomatedNewsletters() { return $this->entity_manager ->createQueryBuilder() ->select('n') diff --git a/lib/Cron/Workers/StatsNotifications/Worker.php b/lib/Cron/Workers/StatsNotifications/Worker.php index d364b1b33a..bf16fe5237 100644 --- a/lib/Cron/Workers/StatsNotifications/Worker.php +++ b/lib/Cron/Workers/StatsNotifications/Worker.php @@ -76,7 +76,7 @@ class Worker { /** @throws \Exception */ function process() { $settings = $this->settings->get(self::SETTINGS_KEY); - foreach (self::getDueTasks() as $stats_notification_entity) { + foreach ($this->repository->findScheduled(Sending::RESULT_BATCH_SIZE) as $stats_notification_entity) { try { $extra_params = [ 'meta' => $this->mailerMetaInfo->getStatsNotificationMetaInfo(), @@ -93,13 +93,6 @@ class Worker { } } - /** - * @return StatsNotificationEntity[] - */ - private function getDueTasks() { - return $this->repository->findDueTasks(Sending::RESULT_BATCH_SIZE); - } - private function constructNewsletter(StatsNotificationEntity $stats_notification_entity) { $newsletter = $stats_notification_entity->getNewsletter(); $link = $this->newsletter_link_repository->findTopLinkForNewsletter($newsletter->getId());