Skip to content

Commit

Permalink
fix(profile): ignore requests without any file or loaders
Browse files Browse the repository at this point in the history
  • Loading branch information
Pooya Parsa committed Mar 24, 2018
1 parent 72768ac commit d3eb446
Showing 1 changed file with 14 additions and 2 deletions.
16 changes: 14 additions & 2 deletions src/profile.js
Original file line number Diff line number Diff line change
Expand Up @@ -7,9 +7,18 @@ export default class Profile {
}

onRequest(request) {
// Measure time for last request
if (this.requests.length) {
this.requests[this.requests.length - 1].time = process.hrtime(this.requests[this.requests.length - 1].start);
delete this.requests[this.requests.length - 1].start;
const lastReq = this.requests[this.requests.length - 1];
if (lastReq.start) {
lastReq.time = process.hrtime(lastReq.start);
delete lastReq.start;
}
}

// Ignore requests without any file or loaders
if (!request.file || !request.loaders.length) {
return;
}

this.requests.push({
Expand Down Expand Up @@ -46,6 +55,9 @@ export default class Profile {
});

const ext = request.file && path.extname(request.file).substr(1);
if (!ext || !ext.length) {
console.log(request);
}
addToStat(extStats, ext && ext.length ? ext : 'unknown', 1, time);
});

Expand Down

0 comments on commit d3eb446

Please sign in to comment.