core(driver): wait for critical network requests#11738
Merged
devtools-bot merged 4 commits intomasterfrom Dec 8, 2020
Merged
Conversation
connorjclark
reviewed
Dec 1, 2020
connorjclark
reviewed
Dec 7, 2020
lighthouse-cli/test/smokehouse/test-definitions/tricky-metrics/expectations.js
Outdated
Show resolved
Hide resolved
connorjclark
reviewed
Dec 7, 2020
| @@ -112,10 +113,10 @@ function waitForFcp(session, pauseAfterFcpMs, maxWaitForFcpMs) { | |||
| * `networkQuietThresholdMs` ms and a method to cancel internal network listeners/timeout. | |||
| * @param {LH.Gatherer.FRProtocolSession} session | |||
| * @param {NetworkRecorder} networkMonitor | |||
Collaborator
There was a problem hiding this comment.
(nit unrelated to PR) any reason this isn't called networkRecorder?
Collaborator
Author
There was a problem hiding this comment.
just an artifact of how it used to be in driver, though honestly networkMonitor does better express it's usage almost everywhere other than for devtoolsLog creation :)
Collaborator
There was a problem hiding this comment.
it always confused me b/c there is no network-monitor file. would be nice to rename one or the other
connorjclark
reviewed
Dec 7, 2020
| return {promise, cancel: mockCancelFn}; | ||
| }); | ||
|
|
||
| return Object.assign(mockFn, {waitForCalls: calls}); |
Collaborator
Author
There was a problem hiding this comment.
if these eyes are for preferring {... that won't work for prototype/class properties of the jest mock fn :)
Collaborator
There was a problem hiding this comment.
ah ya I know. I was just eying the rare case where my blanket "use spread!" doesn't work :)
connorjclark
approved these changes
Dec 7, 2020
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Waits for all critical (high priority) network requests to finish before continuing to the CPU idle check. This solves the issue when the entire page is gated on a single XHR but we move on because we're already at network 2-quiet. This also addresses the problem where the LCP image is very large and added via script where we optimistically report the LCP too early.
The net effect here will be Lighthouse taking a little longer for each run and performance scores dipping as more resources and more CPU work is included in our observations. The net effect on popular sites I tried that don't face the failure case was relatively small. The smoketest and URLs in the linked issues illustrate the massive failure cases we're addressing.
Related Issues/PRs
fixes #11180
fixes #10810
fixes #11639