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
Reduce calls to wp_count_posts( 'product' ) from OnboardingTasks #45125
Conversation
Hi @psealock, @moon0326, @woocommerce/ghidorah Apart from reviewing the code changes, please make sure to review the testing instructions as well. You can follow this guide to find out what good testing instructions should look like: |
Test Results SummaryCommit SHA: 82f24af
To view the full API test report, click here. To view the full E2E test report, click here. To view all test reports, visit the WooCommerce Test Reports Dashboard. |
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 is a nice addition 👍
LGTM and tested well 🚀
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.
Code looks great and tests well 🚀
cbd5a08
to
bce0da7
Compare
bce0da7
to
82f24af
Compare
Submission Review Guidelines:
Changes proposed in this Pull Request:
Closes #43768.
We are calling wp_count_posts( 'product' ) on each admin request. This PR reduces the calls via transient caching.
Besides, similar to tasklist improvement in #44442, improves task performance by having cheaper check first.
How to test the changes in this Pull Request:
Using the WooCommerce Testing Instructions Guide, include your detailed testing instructions:
WooCommerce > Home
wp transient get woocommerce_product_task_product_count_transient
, observe it returns0
Add products
wp transient get woocommerce_product_task_product_count_transient
, observe it returns1
/wp-admin/edit.php?post_type=product
wp transient get woocommerce_product_task_product_count_transient
, observe it returns0
/wp-admin/edit.php?post_status=trash&post_type=product
wp transient get woocommerce_product_task_product_count_transient
, observe it returns1
Changelog entry
Significance
Type
Message
Reduce calls to wp_count_posts( 'product' ) from OnboardingTasks
Comment