Problem/Motivation

I'm experiencing an issue with deployments to non-prod Pantheon environments. Specifically this occurs when drush tries to rebuild the cache, it seems to be triggering cron and one of the queue workers is taking 30+ minutes. I debugged this locally and found it was due to the automated_cron module triggering cron jobs in \Drupal\automated_cron\EventSubscriber\AutomatedCron::onTerminate.

The best way around this is to not use automated cron, but trigger cron jobs with drush. Somehow this is not supported on Pantheon. In saying that, I don't think it makes sense for automated_cron to run on CLI. If you have CLI access you can run cron with drush. Cron should not be triggered during deployments.

Steps to reproduce

Proposed resolution

Don't run \Drupal\automated_cron\EventSubscriber\AutomatedCron::onTerminate on CLI

Remaining tasks

User interface changes

Introduced terminology

API changes

Data model changes

Release notes snippet

Issue fork drupal-3576648

Command icon 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

mstrelan created an issue. See original summary.

mstrelan’s picture

Title: Skip automated cron on drush cache:rebuild or perhaps all CLI commands » Skip automated cron on all CLI commands
Status: Active » Needs review

Cache rebuild now takes 6 seconds instead of 30+ mins

godotislate’s picture

Somehow this is not supported on Pantheon.

Something something kubernetes.

mstrelan’s picture

Addressed all feedback. Apparently I'm not authorised to run test-only jobs, but I verified this locally.

godotislate’s picture

Apparently I'm not authorised to run test-only jobs

I think that's #3576458: [regression] Subsystem and Topics maintainers require access to re-run, trigger, or view tests. But I will run to confirm once the build is done.

godotislate’s picture

Status: Needs review » Reviewed & tested by the community

Had to run a manual build myself in order to have it run in the issue fork instead of the parent project, but here's the test only failure: https://git.drupalcode.org/issue/drupal-3576648/-/jobs/8726517

lgtm.

mstrelan’s picture

Category: Feature request » Bug report

Thank you! I think this should probably be a bug report, so changing the category. Wouldn't mind a review of the CR, if there are any specific recommendations we should add or if linking to the docs page is sufficient.

godotislate’s picture

Reviewed the CR. It's pretty straightforward, so I think it looks good too.

alexpott’s picture

Version: main » 11.3.x-dev
Status: Reviewed & tested by the community » Fixed

Committed and pushed 1bcdac075aa to main and a54eece3442 to 11.x and 5b3a0c37b5f to 11.3.x. Thanks!

Now that this issue is closed, review the contribution record.

As a contributor, attribute any organization that helped you, or if you volunteered your own time.

Maintainers, credit people who helped resolve this issue.

  • alexpott committed 5b3a0c37 on 11.3.x
    fix: #3576648 Skip automated cron on all CLI commands
    
    By: mstrelan
    By:...

  • alexpott committed a54eece3 on 11.x
    fix: #3576648 Skip automated cron on all CLI commands
    
    By: mstrelan
    By:...

  • alexpott committed 1bcdac07 on main
    fix: #3576648 Skip automated cron on all CLI commands
    
    By: mstrelan
    By:...

Status: Fixed » Closed (fixed)

Automatically closed - issue fixed for 2 weeks with no activity.