Problem/Motivation

Similar to how we handle running database updates, cron tasks should also be executed outside of any workspace.

If a specific cron task needs to run inside a workspace, it's implementation should specifically activate it.

Proposed resolution

Add a cron decorator.

Remaining tasks

Review.

User interface changes

Nope.

Introduced terminology

N/A

API changes

Nope. The "Run cron" form can not be submitted in a workspace, and CLI processes are executed without a workspace context by default.

Data model changes

Nope.

Release notes snippet

N/A

Issue fork drupal-3553729

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

amateescu created an issue. See original summary.

amateescu’s picture

Status: Active » Needs review
amateescu’s picture

Title: Ensure that cron task are executed without any workspace context » Ensure that cron tasks are executed without any workspace context
Issue summary: View changes
smustgrave’s picture

Status: Needs review » Reviewed & tested by the community
Issue tags: +Needs Review Queue Initiative

Wasn't entirely sure how to best test this one.

Standard profile install
I verified I couldn't run cron within a workspace with and without the MR.
Outside the workspace (live) it was fine.
So I leaned on the test job https://git.drupalcode.org/issue/drupal-3553729/-/jobs/7057983
Which is getting false while checking for active workspace.
If I understand the ticket correctly this is desired behavior.

  • catch committed 5f1a79d6 on 11.x
    Issue #3553729 by amateescu: Ensure that cron tasks are executed without...
catch’s picture

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

This looks good. It should only really be necessary during automated cron runs, but I can't think of any way to target those that wouldn't be a lot more code and more fragile, so doing it everywhere seems good.

Committed/pushed to 11.x,thanks! Also cherry-picked to 11.3.x.

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.

  • catch committed 090d12d6 on 11.3.x
    Issue #3553729 by amateescu: Ensure that cron tasks are executed without...

Status: Fixed » Closed (fixed)

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