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

timings.receive invalid for cached items #62

Open
sb8244 opened this issue Apr 26, 2020 · 1 comment
Open

timings.receive invalid for cached items #62

sb8244 opened this issue Apr 26, 2020 · 1 comment

Comments

@sb8244
Copy link

sb8244 commented Apr 26, 2020

When I include cached items in my HAR, I get very high receive times for anything cached. I think it's somehow relating when the request was first cached to now, because it increases every time I do a capture.

I fixed it in my project like so:

            const timings = entry.timings || {};
            if (entry.cache.beforeRequest) {
              timings.receive = 0;
            } else {
              timings.receive = formatMillis(
                (params.timestamp - entry._requestTime) * 1000 -
                  entry.__receiveHeadersEnd
              );
            }

I am happy to PR this, although I am not familiar enough with this project to know if it's the right thing to do or not.

P.S. This project is amazing. Doing this by hand would have been such a nightmare, after seeing all of the intricacies here!

@soulgalore
Copy link
Member

Hi @sb8244 thanks for creating the issue. I think when we first created this our only focus was on cold cache hits so its probably a couple of bugs for cached items. A PR would be great would be great, I'm thinking your time calculation should fit somewhere in https://github.com/sitespeedio/chrome-har/blob/master/index.js#L259-L264 maybe? I have very limited time the coming weeks but I can help out as much as I can.

Thanks for the kind words :)

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

No branches or pull requests

2 participants