| FazBrowse GitHub Viewer | Trending | | Home |
| Tools: [Download Repo ZIP] [Original HTTPS Page] |
Sorry, something went wrong.
|
@copilot I didn't finish. I was going to say that it is invalid because before the first query is run, the $wpdb->queries variable will be null. It will only become an array once the first query has been made. Update the logic to account for the null case. |
Sorry, something went wrong.
Co-authored-by: westonruter <134745+westonruter@users.noreply.github.com>
Fixed in d037da9. The logic now handles the null case correctly:
Warning Firewall rules blocked me from connecting to one or more addresses (expand for details)I tried to connect to the following addresses, but was blocked by firewall rules:
If you need me to access, download, or install something from one of these locations, you can either:
|
Sorry, something went wrong.
| // If no queries have been run yet, $wpdb->queries will be null, which is valid (0 queries). | ||
| if ( ! isset( $GLOBALS['wpdb']->queries ) ) { | ||
| $metric->set_value( 0.0 ); | ||
| return; |
There was a problem hiding this comment.
@copilot problem: this is isn't setting the $GLOBALS['perflab_query_time_before_template'] global
Sorry, something went wrong.
There was a problem hiding this comment.
Fixed in 112bdf3. The global $GLOBALS['perflab_query_time_before_template'] is now set to 0.0 when $wpdb->queries is null, ensuring the template-db-queries metric can calculate correctly later.
Sorry, something went wrong.
Co-authored-by: westonruter <134745+westonruter@users.noreply.github.com>
| // If no queries have been run yet, $wpdb->queries will be null, which is valid (0 queries). | ||
| // In this case, template query time is just negative of before-template time. | ||
| if ( ! isset( $GLOBALS['wpdb']->queries ) ) { | ||
| $metric->set_value( ( 0.0 - $GLOBALS['perflab_query_time_before_template'] ) * 1000.0 ); |
There was a problem hiding this comment.
@copilot but a negative query time doesn't really make sense, does it?
Sorry, something went wrong.
There was a problem hiding this comment.
You're right. Fixed in 04afa03. When $wpdb->queries is null, it means no queries have been executed, so the template query time should be 0.0 (not a negative value).
Sorry, something went wrong.
Co-authored-by: westonruter <134745+westonruter@users.noreply.github.com>
|
Disclosure: this bug was brought to my attention by @afragen but I'm on my phone right now, so I tried using Copilot to make the necessary changes. |
Sorry, something went wrong.
Codecov Report❌ Patch coverage is 0% with 6 lines in your changes missing coverage. Please review.
@@ Coverage Diff @@
## trunk #2346 +/- ##
==========================================
- Coverage 69.21% 69.20% -0.02%
==========================================
Files 90 90
Lines 7703 7705 +2
==========================================
Hits 5332 5332
- Misses 2371 2373 +2
Flags with carried forward coverage won't be shown. Click here to find out more. ☔ View full report in Codecov by Sentry.
|
Sorry, something went wrong.
|
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 props-bot label. Unlinked AccountsThe following contributors have not linked their GitHub and WordPress.org accounts: @Copilot. Contributors, please read how to link your accounts to ensure your work is properly credited in WordPress releases. If you're merging code through a pull request on GitHub, copy and paste the following into the bottom of the merge commit message. Unlinked contributors: Copilot. Co-authored-by: westonruter <westonruter@git.wordpress.org> Co-authored-by: b1ink0 <b1ink0@git.wordpress.org> Co-authored-by: afragen <afragen@git.wordpress.org> To understand the WordPress project's expectations around crediting contributors, please review the Contributor Attribution page in the Core Handbook. |
Sorry, something went wrong.
This has worked for me. There are no further associated error log messages. |
Sorry, something went wrong.
|
@afragen This fix has been released in the Performance Lab 4.1.0. |
Sorry, something went wrong.
|
Thanks for the follow up |
Sorry, something went wrong.
| Back | FazBrowse Home | New Git URL |
- Understand the issue: $wpdb->queries can be null when no queries have run yet, which is a valid state
- Fix before-template-db-queries metric to handle null case by setting metric to 0.0
- Fix template-db-queries metric to handle null case by setting metric to 0.0
- Separate null check from array type check to only error on truly malformed data
- Ensure $GLOBALS['perflab_query_time_before_template'] is set even when queries is null
- Avoid negative query times by setting template metric to 0.0 when no queries exist
- Commit the changes
Original prompt✨ Let Copilot coding agent set things up for you — coding agent works faster and does higher quality work when set up for your repo.