diff --git a/Console/Command/ProcessQueueCommand.php b/Console/Command/ProcessQueueCommand.php index 17004181..548b5332 100644 --- a/Console/Command/ProcessQueueCommand.php +++ b/Console/Command/ProcessQueueCommand.php @@ -18,12 +18,18 @@ class ProcessQueueCommand extends Command private $_queue; + private $_state; + + /** * @param State $state * @param Queue $queue */ public function __construct(State $state, Queue $queue) { + + $this->_state = $state; + $this->_queue = $queue; parent::__construct(); } @@ -45,7 +51,10 @@ protected function configure() */ protected function execute(InputInterface $input, OutputInterface $output) { - $success = $this->_queue->runNextJob(); + + $this->_state->setAreaCode(\Magento\Framework\App\Area::AREA_FRONTEND); + + $success = $this->_queue->process(); if ($success === true) { $output->writeln("Queue Processed."); } elseif ($success === false) { diff --git a/Cron/Process.php b/Cron/Process.php new file mode 100644 index 00000000..83802985 --- /dev/null +++ b/Cron/Process.php @@ -0,0 +1,43 @@ +_state = $state; + $this->_queue = $queue; + } + + /** + * @param InputInterface $input + * @param OutputInterface $output + * + * @return string + */ + public function execute() + { + //$this->_state->setAreaCode(\Magento\Framework\App\Area::AREA_FRONTEND); + $success = $this->_queue->process(); + } +} diff --git a/Model/Queue.php b/Model/Queue.php index 798665af..487b6746 100644 --- a/Model/Queue.php +++ b/Model/Queue.php @@ -178,14 +178,10 @@ public function runNextJob() public function process() { $maxJobs = $this->scopeConfig->getValue('springbot/queue/max_jobs'); - if (!is_numeric($maxJobs)) { - $maxJobs = 1; - } + $maxJobs=500; for ($i = 1; $i <= $maxJobs; $i++) { - if ($this->runNextJob() === null) { - return null; - } + $this->runNextJob(); } return true; } diff --git a/etc/config.xml b/etc/config.xml index f702822c..c8899796 100644 --- a/etc/config.xml +++ b/etc/config.xml @@ -5,7 +5,7 @@ - 1 + 100 diff --git a/etc/crontab.xml b/etc/crontab.xml new file mode 100644 index 00000000..c6e87520 --- /dev/null +++ b/etc/crontab.xml @@ -0,0 +1,9 @@ + + + + + */5 * * * * + + + +