Skip to content

Commit ebf7da5

Browse files
author
Serhii Balko
committed
MC-41917: Issue with 'catalog_product_alert' cron
1 parent 5fa67c8 commit ebf7da5

File tree

4 files changed

+15
-14
lines changed

4 files changed

+15
-14
lines changed

app/code/Magento/ProductAlert/Model/Mailing/Consumer.php

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,7 @@ class Consumer
2525
/**
2626
* @var Json
2727
*/
28-
private $jsonHelper;
28+
private $jsonSerializer;
2929

3030
/**
3131
* @var EntityManager
@@ -39,18 +39,18 @@ class Consumer
3939

4040
/**
4141
* @param LoggerInterface $logger
42-
* @param Json $jsonHelper
42+
* @param Json $jsonSerializer
4343
* @param EntityManager $entityManager
4444
* @param AlertProcessor $alertProcessor
4545
*/
4646
public function __construct(
4747
LoggerInterface $logger,
48-
Json $jsonHelper,
48+
Json $jsonSerializer,
4949
EntityManager $entityManager,
5050
AlertProcessor $alertProcessor
5151
) {
5252
$this->logger = $logger;
53-
$this->jsonHelper = $jsonHelper;
53+
$this->jsonSerializer = $jsonSerializer;
5454
$this->entityManager = $entityManager;
5555
$this->alertProcessor = $alertProcessor;
5656
}
@@ -67,7 +67,7 @@ public function process(OperationInterface $operation): void
6767
$errorCode = null;
6868

6969
try {
70-
$data = $this->jsonHelper->unserialize($operation->getSerializedData());
70+
$data = $this->jsonSerializer->unserialize($operation->getSerializedData());
7171
$this->alertProcessor->process($data['alert_type'], $data['customer_ids'], (int)$data['website_id']);
7272
} catch (\Throwable $e) {
7373
$this->logger->critical($e->getMessage());

app/code/Magento/ProductAlert/Model/Mailing/ErrorEmailSender.php

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -68,8 +68,9 @@ public function __construct(
6868
*
6969
* @param array $errors
7070
* @param int $storeId
71+
* @return void
7172
*/
72-
public function execute(array $errors, int $storeId)
73+
public function execute(array $errors, int $storeId): void
7374
{
7475
if (!count($errors)) {
7576
return;

app/code/Magento/ProductAlert/Model/Mailing/Publisher.php

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -47,7 +47,7 @@ class Publisher
4747
/**
4848
* @var Json
4949
*/
50-
private $jsonHelper;
50+
private $jsonSerializer;
5151

5252
/**
5353
* @var int|null
@@ -59,22 +59,22 @@ class Publisher
5959
* @param OperationInterfaceFactory $operationFactory
6060
* @param IdentityGeneratorInterface $identityService
6161
* @param UserContextInterface $userContextInterface
62-
* @param Json $jsonHelper
62+
* @param Json $jsonSerializer
6363
* @param int|null $messageBunchSize
6464
*/
6565
public function __construct(
6666
BulkManagementInterface $bulkManagement,
6767
OperationInterfaceFactory $operationFactory,
6868
IdentityGeneratorInterface $identityService,
6969
UserContextInterface $userContextInterface,
70-
Json $jsonHelper,
70+
Json $jsonSerializer,
7171
?int $messageBunchSize = null
7272
) {
7373
$this->bulkManagement = $bulkManagement;
7474
$this->operationFactory = $operationFactory;
7575
$this->identityService = $identityService;
7676
$this->userContext = $userContextInterface;
77-
$this->jsonHelper = $jsonHelper;
77+
$this->jsonSerializer = $jsonSerializer;
7878
$this->messageBunchSize = $messageBunchSize ?: self::MESSAGE_BUNCH_SIZE_DEFAULT;
7979
}
8080

@@ -89,7 +89,7 @@ public function execute(string $alertType, array $customerIds, int $websiteId):
8989
{
9090
foreach (array_chunk($customerIds, $this->messageBunchSize) as $bunchOfIds) {
9191
$bulkUuid = $this->identityService->generateId();
92-
$serializedData = $this->jsonHelper->serialize(
92+
$serializedData = $this->jsonSerializer->serialize(
9393
[
9494
'alert_type' => $alertType,
9595
'customer_ids' => $bunchOfIds,

app/code/Magento/ProductAlert/Model/Observer.php

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -22,23 +22,23 @@ class Observer
2222
/**
2323
* Error email template configuration
2424
*
25-
* @depreceted
25+
* @deprecated
2626
* @see \Magento\ProductAlert\Model\Mailing\ErrorEmailSender::XML_PATH_ERROR_TEMPLATE
2727
*/
2828
const XML_PATH_ERROR_TEMPLATE = 'catalog/productalert_cron/error_email_template';
2929

3030
/**
3131
* Error email identity configuration
3232
*
33-
* @depreceted
33+
* @deprecated
3434
* @see \Magento\ProductAlert\Model\Mailing\ErrorEmailSender::XML_PATH_ERROR_IDENTITY
3535
*/
3636
const XML_PATH_ERROR_IDENTITY = 'catalog/productalert_cron/error_email_identity';
3737

3838
/**
3939
* 'Send error emails to' configuration
4040
*
41-
* @depreceted
41+
* @deprecated
4242
* @see \Magento\ProductAlert\Model\Mailing\ErrorEmailSender::XML_PATH_ERROR_RECIPIENT
4343
*/
4444
const XML_PATH_ERROR_RECIPIENT = 'catalog/productalert_cron/error_email';

0 commit comments

Comments
 (0)