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

refactor: makes non-finished network records available #2197

Merged
merged 2 commits into from
May 9, 2017

Conversation

patrickhulce
Copy link
Collaborator

split from #2023 (comment)

@brendankenny
Copy link
Member

available internally

Can you clarify "internally"? I don't see the significance

Copy link
Member

@brendankenny brendankenny left a comment

Choose a reason for hiding this comment

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

LGTM. Just updating surrounding comments, and for most of these, it probably makes sense to move the record.finished check first as it's the more
(most?) fundamental differentiator for "this audit isn't for this kind of request"

@@ -61,7 +61,7 @@ class TotalByteWeight extends ByteEfficiencyAudit {
let results = [];
networkRecords.forEach(record => {
// exclude data URIs since their size is reflected in other resources
if (record.scheme === 'data') return;
if (record.scheme === 'data' || !record.finished) return;
Copy link
Member

Choose a reason for hiding this comment

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

update comment

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

done

@@ -56,7 +56,7 @@ class LoadFastEnough4Pwa extends Audit {
// Ignore requests that don't have timing data or resources that have
// previously been requested and are coming from the cache.
const fromCache = record._fromDiskCache || record._fromMemoryCache;
if (!record._timing || fromCache) {
if (!record._timing || fromCache || !record.finished) {
Copy link
Member

Choose a reason for hiding this comment

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

update comment (and it seems like it may make more sense to put !record.finished first)

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

done

@@ -73,7 +73,7 @@ class OptimizedImages extends Gatherer {
static filterImageRequests(pageUrl, networkRecords) {
const seenUrls = new Set();
return networkRecords.reduce((prev, record) => {
if (seenUrls.has(record._url)) {
if (seenUrls.has(record._url) || !record.finished) {
Copy link
Member

Choose a reason for hiding this comment

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

nit: does it make more sense to reverse conditions?

@brendankenny
Copy link
Member

travis is super slow today

@patrickhulce
Copy link
Collaborator Author

comments updated

it probably makes sense to move the record.finished check first as it's the more
(most?) fundamental differentiator for "this audit isn't for this kind of request"

I sort of disagree, the fact that this is the most obvious and requires the least thought makes it ok to put it in the afterthought position and devote the most attention/focus to the domain-specific exclusions which come first

@patrickhulce patrickhulce changed the title refactor: makes non-finished network records available internally refactor: makes non-finished network records available May 9, 2017
@patrickhulce
Copy link
Collaborator Author

Can you clarify "internally"? I don't see the significance

it was a minor point signifying that we still filter out unfinished records almost everywhere so it's mostly an internal change

@brendankenny
Copy link
Member

the fact that this is the most obvious and requires the least thought

Well that's what I mean. Really they could be filtered out before entering into these loops (a la critical request chains) or removed with their own conditional check, but people around here don't seem to like multiple single-line conditionals in a row :)

Anyway, it's good as is.

@patrickhulce patrickhulce merged commit fb3cfbd into master May 9, 2017
@patrickhulce patrickhulce deleted the move_network_records branch May 9, 2017 22:32
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants