diff --git a/lib/Cron/Workers/SimpleWorker.php b/lib/Cron/Workers/SimpleWorker.php index 2b6aec42fb..2e0e5bf009 100644 --- a/lib/Cron/Workers/SimpleWorker.php +++ b/lib/Cron/Workers/SimpleWorker.php @@ -50,6 +50,10 @@ abstract class SimpleWorker implements CronWorkerInterface { $this->cronWorkerScheduler->schedule(static::TASK_TYPE, $this->getNextRunDate()); } + protected function scheduleImmediately(): void { + $this->cronWorkerScheduler->schedule(static::TASK_TYPE, $this->getNextRunDateImmediately()); + } + public function checkProcessingRequirements() { return true; } @@ -73,6 +77,10 @@ abstract class SimpleWorker implements CronWorkerInterface { return $date; } + protected function getNextRunDateImmediately(): Carbon { + return Carbon::createFromTimestamp($this->wp->currentTime('timestamp')); + } + public function scheduleAutomatically() { return static::AUTOMATIC_SCHEDULING; } diff --git a/lib/Cron/Workers/SubscribersEngagementScore.php b/lib/Cron/Workers/SubscribersEngagementScore.php index 30518b73d4..3f8622adf7 100644 --- a/lib/Cron/Workers/SubscribersEngagementScore.php +++ b/lib/Cron/Workers/SubscribersEngagementScore.php @@ -40,14 +40,6 @@ class SubscribersEngagementScore extends SimpleWorker { return true; } - public function scheduleImmediately(): void { - $this->cronWorkerScheduler->schedule(static::TASK_TYPE, $this->getNextRunDateImmediately()); - } - - public function getNextRunDateImmediately(): Carbon { - return Carbon::createFromTimestamp($this->wp->currentTime('timestamp')); - } - public function getNextRunDate() { // random day of the next week $date = Carbon::createFromTimestamp($this->wp->currentTime('timestamp'));