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

update timingInfo to follow new spec changes #1143

Merged
merged 1 commit into from
Dec 14, 2021
Merged

update timingInfo to follow new spec changes #1143

merged 1 commit into from
Dec 14, 2021

Conversation

KhafraDev
Copy link
Member

Implements spec changes from whatwg/fetch@8659a25

refs: #1141 (this didn't take me very long because it was mostly just renaming the utility function)

finalServiceWorkerStartTime: 0,
finalNetworkResponseStartTime: 0,
finalNetworkRequestStartTime: 0,
endTime: 0,
encodedBodySize: 0,
decodedBodySize: 0,
finalConnectionTimingInfo: null,
...init
Copy link
Member Author

Choose a reason for hiding this comment

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

I removed this because the spec states to "return a new fetch timing info whose start time and post-redirect start time are timingInfo’s start time.". Since only startTime and postRedirectStartTime can be changed it seems more explicit to show that their values are the only ones being updated.

const timingInfo = makeTimingInfo({
startTime: currenTime,
postRedirectStartTime: currenTime
const timingInfo = createOpaqueTimingInfo({
Copy link
Member Author

Choose a reason for hiding this comment

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

I'm not sure if this falls under the category of an opaque timing info but it follows the guidelines of having default values and having startTime = postRedirectStartTime

@codecov-commenter
Copy link

codecov-commenter commented Dec 13, 2021

Codecov Report

Merging #1143 (7166794) into main (50fa51b) will not change coverage.
The diff coverage is 50.00%.

Impacted file tree graph

@@           Coverage Diff           @@
##             main    #1143   +/-   ##
=======================================
  Coverage   93.88%   93.88%           
=======================================
  Files          40       40           
  Lines        3809     3809           
=======================================
  Hits         3576     3576           
  Misses        233      233           
Impacted Files Coverage Δ
lib/fetch/util.js 73.13% <ø> (ø)
lib/fetch/index.js 78.86% <50.00%> (ø)

Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update 50fa51b...7166794. Read the comment docs.

@mcollina
Copy link
Member

Can you please add a unit test?

@KhafraDev
Copy link
Member Author

KhafraDev commented Dec 13, 2021

Can you please add a unit test?

I don't know how the following code would be triggered in this package, or at all? I looked for wpt tests and found this open issue that relies upon this spec change to trigger. So we need that 2nd spec change (which adds timingInfo to network errors, and even then, would undici ever trigger this condition?).

I know that's a lot of word soup but I'm trying to say that this PR is needed for a future PR that updates how network errors are handled. I can trigger a network error being made (fetch('about:blank')...) but without the other spec change introduced I'm unsure how to trigger the other times an opaque timingInfo is used 😅.

@mcollina
Copy link
Member

@ronag wdyt?

@ronag
Copy link
Member

ronag commented Dec 14, 2021

I'm ok with merging. It's literally following the spec and for now it's not observable. I was hoping to eventually make timing info observable through e.g. diagnostics channels.

Copy link
Member

@mcollina mcollina left a comment

Choose a reason for hiding this comment

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

lgtm

@mcollina mcollina merged commit bc21562 into nodejs:main Dec 14, 2021
@KhafraDev KhafraDev deleted the opaque-timing-info branch December 14, 2021 14:37
KhafraDev added a commit to KhafraDev/undici that referenced this pull request Jun 23, 2022
metcoder95 pushed a commit to metcoder95/undici that referenced this pull request Dec 26, 2022
crysmags pushed a commit to crysmags/undici that referenced this pull request Feb 27, 2024
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.

4 participants