Download the PHP package graycore/magento2-cron-group-relocation without Composer
On this page you can find all versions of the php package graycore/magento2-cron-group-relocation. It is possible to download/install these versions without Composer. Possible dependencies are resolved automatically.
Download graycore/magento2-cron-group-relocation
More information about graycore/magento2-cron-group-relocation
Files in graycore/magento2-cron-group-relocation
Package magento2-cron-group-relocation
Short Description A Magento 2 module that moves cron jobs into a different cron group than the one their declaring module put them in
License MIT
Informations about the package magento2-cron-group-relocation
Magento 2 Cron Group Relocation
Magento Version Support
Ever have one slow cron job in the default group hold up every other job in that group, and try to move it somewhere else?
Then find it running twice a night — once in reports, and still once in default.
This package moves a cron job into a different group than the one its declaring module put it in, without running it twice.
Purpose
crontab.xml is additive. Magento\Cron\Model\Config\Converter\Xml keys its output [groupId][jobCode] and the DOM merge identifies /config/group/job by group id plus job name, so redeclaring an existing job code under a second group leaves it registered in both. There is no XML construct that removes a job from a group.
That makes a vendor module's group choice effectively final — even though group choice is what controls which jobs share a lock, a process, and a schedule look-ahead window. A single slow job in default can consume the window in which another job's schedule row had to be generated, and Magento only ever schedules forward, so that job is neither run nor marked missed. It silently does not exist for that cycle.
This package lets you put such a job in its own group, so its runtime is somebody else's problem.
Getting Started
This module is intended to be installed with composer. From the root of your Magento 2 project:
-
Download the package
-
Enable the package
-
Declare a destination group in your own module's
etc/cron_groups.xml -
Map jobs into it from your own module's
etc/di.xml -
Sequence your module after this one in
etc/module.xml, so your arguments merge on top - Flush the config cache
Features
- Moves any cron job to any group, keyed by job code — no need to know which module declared it
- Never runs a job twice, unlike redeclaring it in
crontab.xml - Preserves the job's schedule, instance, method and
config_pathexactly as merged - Preserves
core_config_dataschedule overrides — it intercepts downstream ofMagento\Cron\Model\Config\Reader\Db, so the schedule actually in effect travels with the job - Creates no group for a job that doesn't exist, so a disabled declaring module can't leave an empty group behind to be locked and schedule-generated against
- Idempotent, and a no-op when nothing is configured
- No database tables, no admin config, no cron jobs of its own
Upgrading
All versions of magento2-cron-group-relocation with dependencies
magento/framework Version ^102.0 || ^103.0
magento/module-cron Version ^100.4