-
Notifications
You must be signed in to change notification settings - Fork 851
Sync: Stop sending redundant actions when Dedicated Sync fails to enable #46700
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
Sync: Stop sending redundant actions when Dedicated Sync fails to enable #46700
Conversation
|
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. |
|
Are you an Automattician? Please test your changes on all WordPress.com environments to help mitigate accidental explosions.
Interested in more tips and information?
|
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 addresses an issue where redundant sync actions were being sent when Dedicated Sync failed to enable. The fix removes the two updated_option actions from the sync queue when the Dedicated Sync spawn test fails.
Changes:
- Added a
pop_newest()method to remove items from the end of the queue (newest items first) - Modified queue storage implementations to support sorting items in descending order
- Updated the Settings class to remove the two redundant
updated_optionactions when Dedicated Sync fails to enable - Added tests to verify the queue methods and the fix behavior
Reviewed changes
Copilot reviewed 8 out of 8 changed files in this pull request and generated 6 comments.
Show a summary per file
| File | Description |
|---|---|
| projects/packages/sync/src/class-settings.php | Removes the two newest queue items when Dedicated Sync enable fails |
| projects/packages/sync/src/class-queue.php | Adds pop_newest() method and updates fetch_items() to support DESC ordering |
| projects/packages/sync/src/sync-queue/class-queue-storage-table.php | Refactors fetch_items() to accept an order parameter and simplifies SQL query construction |
| projects/packages/sync/src/sync-queue/class-queue-storage-options.php | Refactors fetch_items() to accept an order parameter and simplifies SQL query construction |
| projects/plugins/jetpack/tests/php/sync/Jetpack_Sync_Settings_Test.php | Adds test verification that no data is synced when Dedicated Sync fails to enable |
| projects/plugins/jetpack/tests/php/sync/Jetpack_Sync_Queue_Test.php | Adds tests for the new pop() and pop_newest() queue methods |
| projects/packages/sync/changelog/update-stop-sending-redundant-dedicated_sync_enabled-actions | Changelog entry for the sync package changes |
| projects/plugins/jetpack/changelog/update-stop-sending-redundant-dedicated_sync_enabled-actions | Changelog entry for the Jetpack plugin changes |
projects/plugins/jetpack/tests/php/sync/Jetpack_Sync_Queue_Test.php
Outdated
Show resolved
Hide resolved
projects/packages/sync/changelog/update-stop-sending-redundant-dedicated_sync_enabled-actions
Outdated
Show resolved
Hide resolved
projects/packages/sync/src/sync-queue/class-queue-storage-table.php
Outdated
Show resolved
Hide resolved
projects/plugins/jetpack/tests/php/sync/Jetpack_Sync_Settings_Test.php
Outdated
Show resolved
Hide resolved
projects/plugins/jetpack/tests/php/sync/Jetpack_Sync_Settings_Test.php
Outdated
Show resolved
Hide resolved
Code Coverage SummaryCoverage changed in 5 files.
|
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
Copilot reviewed 8 out of 8 changed files in this pull request and generated 2 comments.
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.
Copilot encountered an error and was unable to review this pull request. You can try again by re-requesting a review.
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
Copilot reviewed 8 out of 8 changed files in this pull request and generated 3 comments.
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.
Copilot encountered an error and was unable to review this pull request. You can try again by re-requesting a review.
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
Copilot reviewed 8 out of 8 changed files in this pull request and generated 4 comments.
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
Copilot reviewed 8 out of 8 changed files in this pull request and generated 2 comments.
projects/plugins/jetpack/changelog/update-stop-sending-redundant-dedicated_sync_enabled-actions
Show resolved
Hide resolved
coder-karen
left a comment
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.
This tests well for me, thanks for working on this!
60930b7 to
0419fff
Compare
Closes SYNC-218
Proposed changes:
Settingsclass to remove the two redundantupdated_optionactions when Dedicated Sync fails to enableOther information:
Jetpack product discussion
SYNC-218
Does this pull request change what data or activity we track or use?
No
Testing instructions:
Dedicated_Sender::DEDICATED_SYNC_VALIDATION_STRINGupdate_optionaction forjetpack_sync_settings_dedicated_sync_enabledoptionImportant: When testing multiple times you'll probably need to remove this transient after each test. In
clirun:wp transient delete jetpack_sync_dedicated_sync_spawn_check