Skip to content

Commit c026abc

Browse files
authored
ENGCOM-5934: fixed schedule currency_rates_update cron job not working #24590
2 parents 7b6bb8a + 1332ba2 commit c026abc

File tree

2 files changed

+12
-3
lines changed

2 files changed

+12
-3
lines changed

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

Lines changed: 9 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,11 @@
1212

1313
namespace Magento\Directory\Model;
1414

15+
/**
16+
* Class Observer
17+
*
18+
* @package Magento\Directory\Model
19+
*/
1520
class Observer
1621
{
1722
const CRON_STRING_PATH = 'crontab/default/jobs/currency_rates_update/schedule/cron_expr';
@@ -83,6 +88,8 @@ public function __construct(
8388
}
8489

8590
/**
91+
* Schedule update currency rates
92+
*
8693
* @param mixed $schedule
8794
* @return void
8895
* @throws \Exception
@@ -122,7 +129,7 @@ public function scheduledUpdateCurrencyRates($schedule)
122129
$importWarnings[] = __('FATAL ERROR:') . ' ' . __('Please specify the correct Import Service.');
123130
}
124131

125-
if (sizeof($errors) > 0) {
132+
if (count($errors) > 0) {
126133
foreach ($errors as $error) {
127134
$importWarnings[] = __('WARNING:') . ' ' . $error;
128135
}
@@ -132,7 +139,7 @@ public function scheduledUpdateCurrencyRates($schedule)
132139
self::XML_PATH_ERROR_RECIPIENT,
133140
\Magento\Store\Model\ScopeInterface::SCOPE_STORE
134141
);
135-
if (sizeof($importWarnings) == 0) {
142+
if (count($importWarnings) == 0) {
136143
$this->_currencyFactory->create()->saveRates($rates);
137144
} elseif ($errorRecipient) {
138145
//if $errorRecipient is not set, there is no sense send email to nobody

app/code/Magento/Directory/etc/crontab.xml

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,8 @@
77
-->
88
<config xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="urn:magento:module:Magento_Cron:etc/crontab.xsd">
99
<group id="default">
10-
<job name="currency_rates_update" instance="Magento\Directory\Model\Observer" method="scheduledUpdateCurrencyRates" />
10+
<job name="currency_rates_update" instance="Magento\Directory\Model\Observer" method="scheduledUpdateCurrencyRates">
11+
<config_path>crontab/default/jobs/currency_rates_update/schedule/cron_expr</config_path>
12+
</job>
1113
</group>
1214
</config>

0 commit comments

Comments
 (0)