Skip to content

fix(cron): restart the scheduler for a new config only while it runs - #65

Open
mrrobot47 wants to merge 1 commit into
EasyEngine:developfrom
mrrobot47:fix/cron-config-keep-stopped-scheduler
Open

mrrobot47 wants to merge 1 commit into
EasyEngine:developfrom
mrrobot47:fix/cron-config-keep-stopped-scheduler

Conversation

@mrrobot47

@mrrobot47 mrrobot47 commented Nov 17, 2026 •

Copy link
Copy Markdown
Member

The upgrade's ee-update-cron-config step and every job change ran docker restart services_global-cron_1. That also starts a stopped container, so a cron disabled before an upgrade ran again afterwards on its old image, while the global compose file already had the new tag, and ee service enable cron reported "already enabled".

update_cron_config() now writes the config and restarts the scheduler only when its state is running or restarting. For an exited, created, paused, dead or missing scheduler it only writes the file; the scheduler reads it when it is next started. ee cron create still brings the scheduler up through init_global_container() before it writes the config.

Behaviour change: ee cron update, ee cron delete and ee site delete no longer start a scheduler that was disabled.

Tested with PHPUnit on PHP 7.4 and 8.5: a running or restart-looping scheduler is restarted, an exited, created, paused, dead or missing one only gets the file, and the upgrade step, ee cron update and ee cron delete leave a disabled scheduler stopped.

Summary by CodeRabbit

  • Bug Fixes
    • Scheduler restarts now occur only when the container is confirmed to be running or restarting. If its status can’t be confirmed or is different, the system logs that it was not restarted.

update_cron_config() ran `docker restart` on the scheduler every time, which also starts a stopped container. The upgrade runs it as the ee-update-cron-config step after the image migration, which leaves a stopped global service on its old image, so a cron disabled with `ee service disable cron` ran again after the upgrade on the old image, and `ee service enable cron` then had nothing to do. Job changes started a disabled scheduler the same way.

Restart the scheduler only when it is running or restart-looping. A stopped or missing one only gets the config file, which it reads when it is next started. `ee cron create` still starts or creates the scheduler first.
@coderabbitai

coderabbitai Bot commented Nov 17, 2026 •

Copy link
Copy Markdown

Explain Change →

No actionable comments were generated in the recent review.

Walkthrough

Changes: Scheduler restart

Layer / File(s) Summary
Inspect status and conditionally restart
src/helper/utils.php
After writing the config, update_cron_config() checks the scheduler container status. It restarts the container for running or restarting statuses and logs when it does not restart.

Change: Bug fix

Merge Risk: Minimal · up to 1b7c3

The change stops config updates from starting a scheduler that is stopped or disabled. No actionable merge-blocking risk remains.

Architecture risk: Low · up to 1b7c3

The change affects 1 system.

Changed systems: src

Architecture concerns
No architecture-level concerns identified.

Review details

Systems and components

  • observed — src (service) was modified; 1 changed file maps to changed impact.

Before / after behavior

  • observed — Modified behavior in src/helper/utils.php: update_cron_config() replaces the unconditional scheduler restart with a status check: it restarts only when docker inspect succeeds and reports running or restarting; for other statuses or inspection failures, it logs that it did not restart the scheduler.
Finishing Touches

Generate unit tests (beta)

  • Create a new PR
  • Autofix · Keep fixing CodeRabbit findings and required CI, and resolving merge conflicts
Recent review info

Run configuration

  • Source mode: Auto
  • Repository: Unavailable
  • Branch: Unavailable
  • File: No configuration file from this repository applied
  • Commit: Unavailable
  • Layers: defaults
  • Review profile: CHILL
  • Plan: Advanced
  • Run ID: 5be030f3-1341-43d2-a301-8cb5a511271a
Commits

Reviewing files that changed from the base of the PR and between e674c8e and 1b7c345.

Files selected for processing: 1

  • src/helper/utils.php

Included review availability: This review used your included allowance. Your plan provides up to 10 included reviews per hour; 9 remain after this review.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant