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

feat: introduce flag to set the http response timeout value #185

Merged
merged 2 commits into from
Jul 13, 2021

Conversation

DennisDenuto
Copy link
Contributor

@DennisDenuto DennisDenuto commented Jul 7, 2021

  • increased the default timeout from 10s -> 30s
  • refactor: Remove copied golang http.DefaultTransport
  • It is easier to see what has been 'changed' from the DefaultTransport.

Authored-by: Dennis Leon leonde@vmware.com

- It is easier to see what has been 'changed' from the DefaultTransport.

Authored-by: Dennis Leon <leonde@vmware.com>
@DennisDenuto DennisDenuto temporarily deployed to TanzuNet Registry Dev e2e July 7, 2021 17:02 Inactive
@DennisDenuto DennisDenuto self-assigned this Jul 7, 2021
InsecureSkipVerify: (opts.VerifyCerts == false),
},
}, nil
clonedDefaultTransport := http.DefaultTransport.(*http.Transport).Clone()
Copy link
Contributor

Choose a reason for hiding this comment

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

the only downside i see here is that if something changes default transport this code will be affected. do we know if anything changing default transport anywhere?

Copy link
Contributor Author

@DennisDenuto DennisDenuto Jul 9, 2021

Choose a reason for hiding this comment

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

the upside is that as we upgrade the http package, we get any changes / updates made to the DefaultTransport. (we avoid drifting from DefaultTransport)

i.e. since inlining the DefaultTransport, we drifted in 2 fields:

  • ForceAttemptHTTP2 setting to true
  • DialContext.DualStack has been deprecated

sounds like a trade-off to me. While the risk you outline is true, currently nothing is mutating the DefaultTransport in our codebase or any of our libraries.

My assumption is that the chance of drifting from stdlib is higher than the chance something will mutate DefaultTransport, and that's why I think this tradeoff is 'worth it'.

Another assumption is that we don't want to drift from stdlib because the go folk are making reasonable sane changes to the DefaultTransport that we want in imgpkg.

@DennisDenuto DennisDenuto temporarily deployed to TanzuNet Registry Dev e2e July 12, 2021 23:03 Inactive
@DennisDenuto DennisDenuto changed the title Refactor: Remove copied golang http.DefaultTransport feat: introduce flag to set the http response timeout value Jul 12, 2021
- used to specify how long requests to the registry should wait for a
http response (headers) from the registry.
- increased the default timeout from 10s -> 30s

Authored-by: Dennis Leon <leonde@vmware.com>
@DennisDenuto DennisDenuto force-pushed the refactor-default-http-transport branch from c264078 to ac194f4 Compare July 13, 2021 19:14
@DennisDenuto DennisDenuto temporarily deployed to TanzuNet Registry Dev e2e July 13, 2021 19:14 Inactive
@cppforlife cppforlife merged commit ee3d2f7 into develop Jul 13, 2021
@joaopapereira joaopapereira deleted the refactor-default-http-transport branch November 8, 2021 19:37
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.

3 participants