Jetpack Sync: REST_Endpoints - Add clear-queue endpoint#47303
Jetpack Sync: REST_Endpoints - Add clear-queue endpoint#47303coder-karen merged 7 commits intotrunkfrom
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! Jetpack plugin: The Jetpack plugin has different release cadences depending on the platform:
If you have any questions about the release process, please ask in the #jetpack-releases channel on Slack. |
Code Coverage SummaryCoverage changed in 3 files.
|
There was a problem hiding this comment.
Pull request overview
This PR adds a new REST endpoint /jetpack/v4/sync/clear-queue that allows clearing Jetpack Sync queues ('sync' or 'full_sync'). When the incremental sync queue is cleared, the endpoint also deletes the temporary sync disable transient to re-enable sending, which is important for maintaining proper sync flow after queue operations.
Changes:
- Added
clear_queueREST endpoint for clearing sync and full_sync queues - Added comprehensive test coverage including valid queue names and invalid queue rejection
- Added changelog entries for both the Jetpack plugin and sync package
Reviewed changes
Copilot reviewed 4 out of 4 changed files in this pull request and generated 1 comment.
| File | Description |
|---|---|
| projects/packages/sync/src/class-rest-endpoints.php | Implements the clear_queue endpoint with validation for queue names and transient cleanup for incremental sync |
| projects/packages/sync/tests/php/REST_Endpoints_Test.php | Adds tests for successful queue clearing, invalid queue rejection, and permission verification |
| projects/plugins/jetpack/changelog/pr-47303 | Changelog entry for Jetpack plugin |
| projects/packages/sync/changelog/pr-47303 | Changelog entry for sync package |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
| public static function clear_queue( $request ) { | ||
| $queue_name = $request->get_param( 'queue' ); | ||
|
|
||
| if ( ! in_array( $queue_name, array( 'sync', 'full_sync' ), true ) ) { |
There was a problem hiding this comment.
I wonder if this is applicable / makes sense for full_sync 🤔
Since we no longer use a Full Sync Queue, rather send actions immediately.
There was a problem hiding this comment.
Ah yes, I modelled this off unlock_queue, but it would seem that needs updating as well?
…only queue is sync now
There was a problem hiding this comment.
Pull request overview
Copilot reviewed 4 out of 4 changed files in this pull request and generated 3 comments.
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
There was a problem hiding this comment.
Pull request overview
Copilot reviewed 4 out of 4 changed files in this pull request and generated 2 comments.
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
Fixes SYNC-257
Proposed changes:
clear-queueSync endpoint, that can be used to clear a queue. Also, if theTEMP_SYNC_DISABLE_TRANSIENT_NAMEtransient was set during incremental sync we want to delete it, in order to re-enable sending.immediate'queue' as this is just used as a pathway intoFull_Sync_ImmediatelyOther information:
Jetpack product discussion
n/a
Does this pull request change what data or activity we track or use?
No.
Testing instructions:
reset_queuefunction inclass.jetpack-sync-manager.php:wpshto confirm a successful response from the API:Changelog