Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Ensure 1st healthcheck runs in the future, not immediately before dispatch #116

Merged
merged 1 commit into from
Feb 28, 2024

Conversation

ianmjones
Copy link
Member

Fixes a problem whereby as soon as the healthcheck cron event was scheduled, it ran straight away, even before the background process was dispatched.

This resulted in the cron event starting the background process dispatch chain and the dispatch() itself often being redundant.

Now the healthcheck cron is scheduled to start at the allotted cron interval in the future, continuing to reschedule itself at that interval from then on until the background process completes or is cancelled.

The filter that fires to set the cron interval now only fires once rather than potentially twice if the WP_Background_Process subclass has a cron_interval property added.

A get_cron_interval() method has been added that enables determining what the background process's healthcheck cron interval is.

Copy link
Contributor

@eriktorsner eriktorsner left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM 👍

@ianmjones ianmjones merged commit 6d1e481 into master Feb 28, 2024
4 checks passed
@ianmjones ianmjones deleted the fix-healthcheck-running-too-soon branch February 28, 2024 13:39
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants