From c4d5d7576a2a8e5d4dd2a8aa226e8af23634d34c Mon Sep 17 00:00:00 2001 From: Joey Kimsey Date: Mon, 6 Jan 2020 14:01:02 -0500 Subject: [PATCH 1/5] bugfix --- Console/Command/ProcessQueueCommand.php | 5 +++-- etc/module.xml | 2 +- 2 files changed, 4 insertions(+), 3 deletions(-) diff --git a/Console/Command/ProcessQueueCommand.php b/Console/Command/ProcessQueueCommand.php index 52b7b6d9..f3cdc432 100644 --- a/Console/Command/ProcessQueueCommand.php +++ b/Console/Command/ProcessQueueCommand.php @@ -26,8 +26,9 @@ public function __construct(State $state, Queue $queue) { $this->_state = $state; $this->_queue = $queue; - - $state->setAreaCode('adminhtml'); + if (!$state->getAreaCode()) { + $state->setAreaCode('adminhtml'); + } parent::__construct(); } diff --git a/etc/module.xml b/etc/module.xml index 62fcbf04..349d798c 100644 --- a/etc/module.xml +++ b/etc/module.xml @@ -2,5 +2,5 @@ - + From 38fb4eb064bca7a985a7ac21a5fee043e8cfa859 Mon Sep 17 00:00:00 2001 From: Joey Kimsey Date: Wed, 22 Jan 2020 12:02:46 -0500 Subject: [PATCH 2/5] small change --- Console/Command/ProcessQueueCommand.php | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/Console/Command/ProcessQueueCommand.php b/Console/Command/ProcessQueueCommand.php index f3cdc432..404be820 100644 --- a/Console/Command/ProcessQueueCommand.php +++ b/Console/Command/ProcessQueueCommand.php @@ -26,8 +26,9 @@ public function __construct(State $state, Queue $queue) { $this->_state = $state; $this->_queue = $queue; + if (!$state->getAreaCode()) { - $state->setAreaCode('adminhtml'); + $this->_state->setAreaCode(\Magento\Framework\App\Area::AREA_FRONTEND); } parent::__construct(); From 97bc58f3adf7519200fb585c72b1f113c1dc3197 Mon Sep 17 00:00:00 2001 From: Joey Kimsey Date: Wed, 22 Jan 2020 12:04:45 -0500 Subject: [PATCH 3/5] fix --- Console/Command/ProcessQueueCommand.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Console/Command/ProcessQueueCommand.php b/Console/Command/ProcessQueueCommand.php index 404be820..ab81fe8e 100644 --- a/Console/Command/ProcessQueueCommand.php +++ b/Console/Command/ProcessQueueCommand.php @@ -28,7 +28,7 @@ public function __construct(State $state, Queue $queue) $this->_queue = $queue; if (!$state->getAreaCode()) { - $this->_state->setAreaCode(\Magento\Framework\App\Area::AREA_FRONTEND); + $this->_state->setAreaCode(\Magento\Framework\App\Area::AREA_ADMINHTML); } parent::__construct(); From b54b8278a7be1da3ca5170cb51bcb74afd14c7d1 Mon Sep 17 00:00:00 2001 From: Joey Kimsey Date: Wed, 22 Jan 2020 12:10:27 -0500 Subject: [PATCH 4/5] test --- Console/Command/ProcessQueueCommand.php | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/Console/Command/ProcessQueueCommand.php b/Console/Command/ProcessQueueCommand.php index ab81fe8e..dfd32cb4 100644 --- a/Console/Command/ProcessQueueCommand.php +++ b/Console/Command/ProcessQueueCommand.php @@ -26,8 +26,9 @@ public function __construct(State $state, Queue $queue) { $this->_state = $state; $this->_queue = $queue; - - if (!$state->getAreaCode()) { + try { + $this->_state->getAreaCode(); + } catch (\Throwable $e) { $this->_state->setAreaCode(\Magento\Framework\App\Area::AREA_ADMINHTML); } From fbc948682de6cf46b8962694ea6cd5eeeb453291 Mon Sep 17 00:00:00 2001 From: Joey Kimsey Date: Wed, 22 Jan 2020 12:23:59 -0500 Subject: [PATCH 5/5] test 2 --- Console/Command/ProcessQueueCommand.php | 12 +++++++----- 1 file changed, 7 insertions(+), 5 deletions(-) diff --git a/Console/Command/ProcessQueueCommand.php b/Console/Command/ProcessQueueCommand.php index dfd32cb4..9db28aca 100644 --- a/Console/Command/ProcessQueueCommand.php +++ b/Console/Command/ProcessQueueCommand.php @@ -26,11 +26,6 @@ public function __construct(State $state, Queue $queue) { $this->_state = $state; $this->_queue = $queue; - try { - $this->_state->getAreaCode(); - } catch (\Throwable $e) { - $this->_state->setAreaCode(\Magento\Framework\App\Area::AREA_ADMINHTML); - } parent::__construct(); } @@ -52,7 +47,14 @@ protected function configure() */ protected function execute(InputInterface $input, OutputInterface $output) { + try { + $this->_state->getAreaCode(); + } catch (\Throwable $e) { + $this->_state->setAreaCode(\Magento\Framework\App\Area::AREA_ADMINHTML); + } + $success = $this->_queue->runNextJob(); + if ($success === true) { $output->writeln("Queue Processed."); } elseif ($success === false) {