Move scheduleImmediately to SimpleWorker
[MAILPOET-3585]
This commit is contained in:
@ -50,6 +50,10 @@ abstract class SimpleWorker implements CronWorkerInterface {
|
|||||||
$this->cronWorkerScheduler->schedule(static::TASK_TYPE, $this->getNextRunDate());
|
$this->cronWorkerScheduler->schedule(static::TASK_TYPE, $this->getNextRunDate());
|
||||||
}
|
}
|
||||||
|
|
||||||
|
protected function scheduleImmediately(): void {
|
||||||
|
$this->cronWorkerScheduler->schedule(static::TASK_TYPE, $this->getNextRunDateImmediately());
|
||||||
|
}
|
||||||
|
|
||||||
public function checkProcessingRequirements() {
|
public function checkProcessingRequirements() {
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
@ -73,6 +77,10 @@ abstract class SimpleWorker implements CronWorkerInterface {
|
|||||||
return $date;
|
return $date;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
protected function getNextRunDateImmediately(): Carbon {
|
||||||
|
return Carbon::createFromTimestamp($this->wp->currentTime('timestamp'));
|
||||||
|
}
|
||||||
|
|
||||||
public function scheduleAutomatically() {
|
public function scheduleAutomatically() {
|
||||||
return static::AUTOMATIC_SCHEDULING;
|
return static::AUTOMATIC_SCHEDULING;
|
||||||
}
|
}
|
||||||
|
@ -40,14 +40,6 @@ class SubscribersEngagementScore extends SimpleWorker {
|
|||||||
return true;
|
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() {
|
public function getNextRunDate() {
|
||||||
// random day of the next week
|
// random day of the next week
|
||||||
$date = Carbon::createFromTimestamp($this->wp->currentTime('timestamp'));
|
$date = Carbon::createFromTimestamp($this->wp->currentTime('timestamp'));
|
||||||
|
Reference in New Issue
Block a user