-
Notifications
You must be signed in to change notification settings - Fork 835
Forms: Optimize has_feedback() query for better performance #45361
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.
|
b4c95d9
to
8891313
Compare
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 optimizes the has_feedback()
method in the Forms dashboard to improve performance by modifying the query to only fetch what's necessary to determine if feedback exists.
- Limits query to fetch only 1 post instead of all feedback posts
- Disables unnecessary caching and metadata loading
- Changes return logic to use
have_posts()
instead offound_posts
Reviewed Changes
Copilot reviewed 2 out of 2 changed files in this pull request and generated 1 comment.
File | Description |
---|---|
projects/packages/forms/src/dashboard/class-dashboard.php | Optimizes the feedback existence check query with performance parameters |
projects/packages/forms/changelog/update-optimize-has-feedback-query | Adds changelog entry documenting the performance optimization |
Tip: Customize your code reviews with copilot-instructions.md. Create the file or learn how to get started.
@@ -0,0 +1,4 @@ | |||
Significance: patch | |||
Type: fixed |
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.
The changelog type should be 'changed' rather than 'fixed' since this is a performance optimization, not a bug fix.
Type: fixed | |
Type: changed |
Copilot uses AI. Check for mistakes.
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.
It fixes things for sites with really large DBs.
This is part of a larger effort: #45339 |
Proposed changes:
Optimizes the
has_feedback()
method in the Forms dashboard to improve performance on sites with large numbers.Other information:
Jetpack product discussion
Performance optimization discussed internally.
Does this pull request change what data or activity we track or use?
No
Testing instructions:
Prerequisites:
Steps:
/wp-json/wp/v2/feedback/config
requestExpected behavior:
This is part of a larger effort: #45339