-
Notifications
You must be signed in to change notification settings - Fork 9.4k
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
Conversation
core/audits/server-response-time.js
Outdated
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. |
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.
// 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) { |
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.
Add a test for this case?
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.
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; |
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.
If we are in LR will record.timing
always be falsy?
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.
Not yet, that is to come.
183454c
to
a2e71c0
Compare
a2e71c0
to
9d2400e
Compare
This uses the appropriate header in LR to estimate the server response time.