-
Notifications
You must be signed in to change notification settings - Fork 9.4k
Description
Summary (*)
Magento 2.4.4
Crons groups that can be parallelized are launched via the main cron:run
command. This can be a problem if that process is taking too long.
Examples (*)
Use case :
Let's say you have one group group_example
that have use_separate_process
to 1
, where there is a job job_example
that need to be executed every minutes.
Let's also say that the others groups are taking 10min to execute (long reindex, or whatever).
It means that the command /usr/local/bin/php /var/www/html/bin/magento cron:run --group=group_example --bootstrap=standaloneProcessStarted=1
is run every 10 minutes.
Which means job_example
may not be executing for 10 minutes.
(the number "10" minutes is arbitrary for the example, I'm sure sometimes it could be a lot more)
Proposed solution
It would be more safe and logical if the separate processes were not launched by the cron:run
command.
Those parallelization-friendly groups should be added to crontab by cron:install
directly.
Also, other subject but a linked one, we should probably prevent cron:run
to be launched when another is already running to avoid accumulation risks. cron:run
can be launched with flock
for instance : flock -w 0 /tmp/magento.cron.lock /usr/local/bin/php {magentoRoot}bin/magento cron:run
Of course, we can modify all this manually via di.xml
, but maybe it should be native.
Please provide Severity assessment for the Issue as Reporter. This information will help during Confirmation and Issue triage processes.
- Severity: S0 - Affects critical data or functionality and leaves users with no workaround.
- Severity: S1 - Affects critical data or functionality and forces users to employ a workaround.
- Severity: S2 - Affects non-critical data or functionality and forces users to employ a workaround.
- Severity: S3 - Affects non-critical data or functionality and does not force users to employ a workaround.
- Severity: S4 - Affects aesthetics, professional look and feel, “quality” or “usability”.