-
Notifications
You must be signed in to change notification settings - Fork 140
Add notices and improved type checking for $wpdb->queries when attempting to compute server-timing for database queries
#2159
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
This comment was marked as outdated.
This comment was marked as outdated.
|
The following accounts have interacted with this PR and/or linked issues. I will continue to update these lists as activity occurs. You can also manually ask me to refresh this list by adding the If you're merging code through a pull request on GitHub, copy and paste the following into the bottom of the merge commit message. To understand the WordPress project's expectations around crediting contributors, please review the Contributor Attribution page in the Core Handbook. |
Codecov Report❌ Patch coverage is
Additional details and impacted files@@ Coverage Diff @@
## trunk #2159 +/- ##
==========================================
- Coverage 68.81% 68.54% -0.27%
==========================================
Files 90 90
Lines 8006 8037 +31
==========================================
Hits 5509 5509
- Misses 2497 2528 +31
Flags with carried forward coverage won't be shown. Click here to find out more. ☔ View full report in Codecov by Sentry. 🚀 New features to boost your workflow:
|
|
Build for testing: performance-lab.zip |
|
PR fixes issue in testing: #2158 (comment) |
adamsilverstein
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.
Code looks good!
Fixes #2158
This addresses issues which may arise when using a database implementation which doesn't construct
$wpdb->queriesin the same way as core does, namely when a logged query is not an indexed array or it it doesn't have a float at index 1. This can happen when using a customsave_query_callbackin HyperDB, for example. This essentially builds upon the existing type checking for odd database implementations which don't define$wpdb->queries. In both cases, notices are now emitted before aborting.If
$wpdb->queriesis absent or not an array, this notice is emitted:If a saved query array doesn't have the expected elapsed time as the second argument, then this notice is emitted:
Otherwise, if all is good, then the
before-template-db-queriesserver timing entry is sent: