This article provides a patch for a known Magento Commerce 2.2.2 issue related to having multiple cron jobs scheduled to run at the same time after the time variables for certain tasks were edited in the Magento Admin.
When cron is configured to run every minute, if you edit time variables for three scheduled tasks in Admin, the
cron_schedule database table shows groups of multiple tasks scheduled to run at the same time.
Steps to reproduce:
- In Magento Admin, navigate to Stores > Settings > Configuration > ADVANCED > System > Cron (Scheduled Tasks) > Cron configuration options for group: default.
- Configure the following options:
- History Cleanup Every: clear the Use system checkbox, and set to 1440
- Success History Lifetime: clear the Use system checkbox, and set to 1440
- Failure History Lifetime: clear the Use system checkbox, and set to 1440
root/base/projectdirectory in each terminal window.
bin/magento cache:flush && bin/magento cron:run && bin/magento cache:flush && bin/magento cron:run
SELECT job_code, scheduled_at, count as count FROM cron_schedule GROUP BY job_code, scheduled_at HAVING count > 1 ORDER BY scheduled_at;
job_code should be scheduled for the certain time period.
There are multiple cron jobs scheduled for the same time period.
For Magento Commerce Cloud customers, updating the ECE-tools will solve the issue.
Magento Commerce customers should apply one of the attached patches to solve the issue.
The patches are attached to this article. To download, scroll down to the end of the article and click the file name, or click one the following link:
- Download MDVA-11304_EE_2.1.4_COMPOSER_v1.patch
- Download MDVA-11304_EE_2.1.5_COMPOSER_v1.patch
- Download MDVA-11304_EE_2.1.13_COMPOSER_v1.patch
- Download MDVA-11304_EE_2.1.14_COMPOSER_v1.patch
- Download MDVA-11304_EE_2.2.0_COMPOSER_v1.patch
- Download MDVA-11304_EE_2.2.2_COMPOSER_v1.patch
- Download MDVA-11304_EE_2.2.4_COMPOSER_v1.patch
Compatible Magento versions
The patches were created for particular version noted in the patch file name. For example, MDVA-11304_EE_2.2.4_COMPOSER_v1.patch was created for Magento Commerce 2.2.4 and is the best patch to be used for this version.
The patches are also compatible with the following versions:
- For Magento Commerce 2.1.0-2.1.4:
- For Magento Commerce 2.1.5-2.1.12:
- For Magento Commerce 2.1.13:
- For Magento Commerce 2.1.4-2.1.7:
- For Magento Commerce 2.2.0-2.2.1:
- For Magento Commerce 2.2.0-2.2.3:
- For Magento Commerce 2.2.4:
The patch is also compatible (but might not solve the issue) with the following Magento versions and editions:
- Magento Commerce 2.1.14-2.1.17
- Magento Commerce 2.2.0, 2.2.1, 2.2.4
- Magento Commerce Cloud 2.2.0-2.2.4
How to apply the patch
See How to apply a composer patch provided by Magento for instructions.