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(network-recorder): use findNetworkQuietPeriods for networkIdle #4102

Merged
merged 3 commits into from
Jan 2, 2018

Conversation

patrickhulce
Copy link
Collaborator

fixes #3734

@patrickhulce patrickhulce changed the title core(NetworkRecorder): fix inconsistent timestamps core(network-recorder): fix inconsistent timestamps Dec 20, 2017
Copy link
Member

@paulirish paulirish left a comment

Choose a reason for hiding this comment

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

between the move into NetworkRecorder and the style changes, the diff is harder to spot. can you help me out?

@@ -53,22 +130,17 @@ class NetworkRecorder extends EventEmitter {
*/
onRequestStarted(request) {
this.startedRequestCount++;
request.data._observedNodeStartTime = Date.now();
Copy link
Member

Choose a reason for hiding this comment

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

what are we doing with these two timestamps?

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

we actually aren't anymore but it was useful for debugging delta between trace and epoch timestamps :)

@patrickhulce
Copy link
Collaborator Author

findNetworkQuietPeriods is largely untouched other than 1 new filter that's arguably unnecessary, the meat of the PR is that we use these periods to determine isIdle and isIdle2 instead of the old counts

if (activeCount === 1) {
this.emit('networkbusy');
}
log.verbose(
Copy link
Member

Choose a reason for hiding this comment

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

do we want to keep these lines attached to activeRequestCount now? since our idling logic isn't related it seems better to drop the logs or have them log out the networkStatus

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

yeah good point I just removed all other active request count tracking since we don't really need it, moved log to network status

* @param {!Array<!WebInspector.NetworkRequest>} networkRecords
* @param {number} allowedConcurrentRequests
* @param {number=} endTime
* @return {!Array<{start: number, end: number, ongoing: boolean|undefined}>}
Copy link
Member

Choose a reason for hiding this comment

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

naming bikeshed! is ongoing === "in flight"? if so i'd prefer that as a name, but i suspect there's a difference already..... :)

Copy link
Collaborator Author

@patrickhulce patrickhulce Dec 27, 2017

Choose a reason for hiding this comment

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

yeah they're different haha :)

it's a flag to signal that this period had no end, basically that it's Infinity even though we mark it at endTime, suggestions welcome I just nuked it instead :)

@paulirish
Copy link
Member

paulirish commented Jan 2, 2018

@patrickhulce before landing, should we tweak this commit message any? i feel like there's a decent size gap between the actual change and the fix. how about something like this:

use findNetworkQuietPeriods for networkIdle calculations

land at will.

@patrickhulce
Copy link
Collaborator Author

yeah name change sgtm 👍

@patrickhulce patrickhulce changed the title core(network-recorder): fix inconsistent timestamps core(network-recorder): use findNetworkQuietPeriods for networkIdle Jan 2, 2018
@patrickhulce patrickhulce merged commit d7a9f3b into master Jan 2, 2018
@patrickhulce patrickhulce deleted the fix_network_idle_timestamps branch January 2, 2018 21:58
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.

Network timestamps differ significantly from NetworkRecorder observed time
3 participants