-
Notifications
You must be signed in to change notification settings - Fork 841
Jetpack Sync: Prevent syncing unchanged orders on save or update within a short window #45822
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
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! |
Code Coverage SummaryCoverage changed in 1 file.
Full summary · PHP report · JS report If appropriate, add one of these labels to override the failing coverage check:
Covered by non-unit tests
|
d82a818 to
4975a0e
Compare
| /** | ||
| * Cache expiration for storing order content signatures. | ||
| */ | ||
| const CACHE_EXPIRATION = 5 * MINUTE_IN_SECONDS; |
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.
Should this be longer?
|
After speaking with @fgiannar who mentioned the impact on checksums - fix checksums will run every time the cache site does not match the remote site, and that includes as little as the modified date - I'll close this. In short the benefits may be negligible. |
Closes SYNC-164
Proposed changes:
woocommerce_update_order_itemandwoocommerce_after_order_object_saveaction items being synced if there are no changes within a specific time window (due to a transient or persistent object cache if present), if the order is saved more than once in that time period.on_before_enqueue_order_save, which is hooked into thejetpack_sync_before_enqueue_woocommerce_after_{$type}_object_savefilter, in this save flow both the per‑item updates and the order save occur in the same request. With our before‑enqueue guard, that request ends up with nothing meaningful to send, so those per‑itemwoocommerce_update_order_itemevents are not synced in this path.Other information:
Jetpack product discussion
SYNC-164
Does this pull request change what data or activity we track or use?
No.
Testing instructions:
To replicate the issue:
/wp-admin/admin.php?page=wc-settings&tab=advanced):wpshwhen sandboxed:gpr select * from wp_YOURBLOGID_wc_ordersandgpr select * from wp_YOURBLOGID_woocommerce_order_itemmetawoocommerce_after_order_object_saveaction synced, as well as onewoocommerce_update_order_itemfor each order item.wpsh, nothing should have changed.To test the changes:
wpsh, nothing should have changed.