[go: nahoru, domu]

Skip to content
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

core(server-response-time): fix for lightrider #15156

Merged
merged 2 commits into from
Jun 13, 2023

Conversation

connorjclark
Copy link
Collaborator

This uses the appropriate header in LR to estimate the server response time.

@connorjclark connorjclark requested a review from a team as a code owner June 12, 2023 22:53
@connorjclark connorjclark requested review from adamraine and removed request for a team June 12, 2023 22:53
const timing = record.timing;
return timing ? timing.receiveHeadersStart - timing.sendEnd : 0;
// Lightrider does not have timings for sendEnd, but we do have this timing which should be
// close.
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
// close.
// close to the response time.

@@ -61,6 +68,14 @@ class ServerResponseTime extends Audit {
const mainResource = await MainResource.request({devtoolsLog, URL: artifacts.URL}, context);

const responseTime = ServerResponseTime.calculateResponseTime(mainResource);
if (responseTime === null) {
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Add a test for this case?

Copy link
Collaborator Author
@connorjclark connorjclark Jun 12, 2023

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'm not aware of a way to force a undefined timing with our unit testing, give we must construct a devtools log as the input.

// close.
if (global.isLightrider && record.lrStatistics) return record.lrStatistics.requestMs;

if (!record.timing) return null;
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

If we are in LR will record.timing always be falsy?

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Not yet, that is to come.

core/audits/server-response-time.js Outdated Show resolved Hide resolved
@devtools-bot devtools-bot merged commit cf6f3ad into main Jun 13, 2023
32 of 33 checks passed
@devtools-bot devtools-bot deleted the server-response-time-lr branch June 13, 2023 22:14
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants