Skip to content

Conversation

@westonruter
Copy link
Member

When Optimization Detective active, I noticed a _doing_it_wrong() warning in Query Monitor:

Screenshot 2024-04-30 17 12 00

In the Server-Timing admin page, output buffering is not enabled:

image

The issue is that Performance Lab's Server-Timing functionality is not aware that Optimization Detective is doing output buffering of the template (although it used to be in #875, but it was backed out in #1082). So the PL functionality is sending the Server-Timing header after Optimization Detective starts buffering the output, but then when the buffer closes and the server timing wrapper attempts to then process the timing, it fails because the header has already been sent. So we need to add an additional check for whether the output buffering checkbox has been checked (via the perflab_server_timing_use_output_buffer() function).

(If Performance Lab had been aware of the Optimization Detective output buffer, then it wouldn't need the checkbox at all since the Server-Timing header could be sent after the output buffer is closed.)

@westonruter westonruter added [Type] Bug An existing feature is broken [Plugin] Optimization Detective Issues for the Optimization Detective plugin labels May 1, 2024
@westonruter westonruter requested a review from felixarntz as a code owner May 1, 2024 00:27
@github-actions
Copy link

github-actions bot commented May 1, 2024

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.

If you're merging code through a pull request on GitHub, copy and paste the following into the bottom of the merge commit message.

Co-authored-by: westonruter <[email protected]>
Co-authored-by: swissspidy <[email protected]>

To understand the WordPress project's expectations around crediting contributors, please review the Contributor Attribution page in the Core Handbook.

@westonruter westonruter requested a review from swissspidy May 3, 2024 00:42
@westonruter westonruter merged commit 5f069c8 into trunk May 3, 2024
@westonruter westonruter deleted the fix/optimization-detective-server-timing branch May 3, 2024 19:13
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

[Plugin] Optimization Detective Issues for the Optimization Detective plugin [Type] Bug An existing feature is broken

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants