Problem/Motivation
Ultimate cron implements hook_modules_installed.
As mentioned in #3186352-19: Module is incompatible with Drupal Configuration Sync processes, we could improve the implementation by avoiding calling \Drupal::service('ultimate_cron.discovery')->discoverCronJobs() during configuration import.
Also, not fully tested, when installing a site from an installation profile using existing configuration (for example via drush site:install --existing-config), the Ultimate Cron module triggers cron job discovery during configuration synchronization. During config sync, configuration entities may not yet be fully available, which can lead to fatal errors or broken installs.
Steps to reproduce
Proposed resolution
Update ultimate_cron_modules_installed() to respect the $is_syncing flag and skip cron job discovery during configuration synchronization.
function ultimate_cron_modules_installed($modules, $is_syncing) {
if (!$is_syncing) {
\Drupal::service('ultimate_cron.discovery')->discoverCronJobs();
}
}Remaining tasks
User interface changes
API changes
Data model changes
Issue fork ultimate_cron-3564853
Show commands
Start within a Git clone of the project using the version control instructions.
Or, if you do not have SSH keys set up on git.drupalcode.org:
Comments
Comment #3
tuwebo commentedI've added the check to avoid calling
\Drupal::service('ultimate_cron.discovery')->discoverCronJobs();during sinchronization. Tests seem to be passing for previous version and failing for this one, but I think it is not related to this particular change. So I am moving it to Needs review.Comment #4
berdircan we remove hook_install() completely which also doesn't check this as I think hook_modules_installed() is also called for itself?
Comment #6
berdirTests contain explicit calls to the install hook, that needs to be updated.
Comment #7
primsi commentedComment #9
berdirMerging.