-
Notifications
You must be signed in to change notification settings - Fork 854
Jetpack Sync: Allow syncing directly during cron #46887
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
base: trunk
Are you sure you want to change the base?
Jetpack Sync: Allow syncing directly during cron #46887
Conversation
|
Are you an Automattician? Please test your changes on all WordPress.com environments to help mitigate accidental explosions.
Interested in more tips and information?
|
|
Thank you for your PR! When contributing to Jetpack, we have a few suggestions that can help us test and review your patch:
This comment will be updated as you work on your PR and make changes. If you think that some of those checks are not needed for your PR, please explain why you think so. Thanks for cooperation 🤖 Follow this PR Review Process:
If you have questions about anything, reach out in #jetpack-developers for guidance! |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Pull request overview
This PR modifies the sync behavior to bypass the dedicated sync flow during cron requests, instead syncing directly. The change aims to reduce sync lag for time-sensitive events by avoiding HTTP request spawning during cron shutdown, which can be unreliable.
Changes:
- Modified
do_sync()method to check if the current request is a cron request and bypass dedicated sync if so - Added explanatory comment describing the rationale for the cron bypass
- Added changelog entry documenting the change
Reviewed changes
Copilot reviewed 2 out of 2 changed files in this pull request and generated 1 comment.
| File | Description |
|---|---|
| projects/packages/sync/src/class-sender.php | Added cron detection logic to bypass dedicated sync flow and sync directly during cron requests |
| projects/packages/sync/changelog/update-sync-do-sync-cron-bypass-dedicated-route | Added changelog entry documenting the behavior change |
| Significance: minor | ||
| Type: changed | ||
|
|
||
| Sync: Ensure we sync directly during cron. |
Copilot
AI
Feb 2, 2026
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Remove the "Sync:" prefix from the changelog entry. According to the project's changelog conventions, entries should not use the package name as a prefix when they are within that same package. The entry should simply read "Ensure we sync directly during cron." instead.
Code Coverage SummaryThis PR did not change code coverage! That could be good or bad, depending on the situation. Everything covered before, and still is? Great! Nothing was covered before? Not so great. 🤷 |
Fixes SYNC-221
Proposed changes:
do_syncto see if a current request is a cron request. If so, we'll bypass the dedicated sync flow which would otherwise be spawning HTTP requests during cron shutdown, and we now sync directly. This is more reliable, and should reduce lag.Other information:
Jetpack product discussion
n/a
Does this pull request change what data or activity we track or use?
No.
Testing instructions:
To test, on a Jetpack self-hosted site that is Jetpack API sandboxed, running the latest trunk or stable release of Jetpack:
wp_version_check. Click 'edit', and edit the time of the next run to just a few minutes away.jetpack_update_plugins_change(using the plugin update snippet) and note down thelag_floattime. Do this a few times and record the results. Logstash: bea0fa92853f5aab8a03cab24dfdb9c6-logstash (changing your blog ID).jetpack_update_themes_changeaction lag times.To test the changes:
lag_floatshould be consistently lower (for example in my case the difference was '2' to '0.2' or thereabouts).$argsin WPcom is correct).