Share the $wp property between workers

[MAILPOET-2396]
This commit is contained in:
Amine Ben hammou
2019-12-11 13:30:52 +01:00
committed by Jack Kitterhing
parent 2a70a4813c
commit 20eccaad67
5 changed files with 11 additions and 15 deletions

View File

@@ -15,13 +15,9 @@ class Beamer extends SimpleWorker {
/** @var SettingsController */
private $settings;
/** @var WPFunctions */
private $wp;
public function __construct(SettingsController $settings, WPFunctions $wp) {
parent::__construct();
parent::__construct($wp);
$this->settings = $settings;
$this->wp = $wp;
}
public function processTaskStrategy(ScheduledTask $task, $timer) {
@@ -43,8 +39,7 @@ class Beamer extends SimpleWorker {
}
public function getNextRunDate() {
$wp = new WPFunctions;
$date = Carbon::createFromTimestamp($wp->currentTime('timestamp'));
$date = Carbon::createFromTimestamp($this->wp->currentTime('timestamp'));
return $date->hour(11)->minute(00)->second(00)->addDay();
}
}