Merge pull request #12203 from 0xff-dev/main

chore: HTTPGetter add default timeout
pull/12316/head
Joe Julian 11 months ago committed by GitHub
commit a749b66310
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

@ -179,9 +179,21 @@ func (p Providers) ByScheme(scheme string) (Getter, error) {
return nil, errors.Errorf("scheme %q not supported", scheme)
}
const (
// The cost timeout references curl's default connection timeout.
// https://github.com/curl/curl/blob/master/lib/connect.h#L40C21-L40C21
// The helm commands are usually executed manually. Considering the acceptable waiting time, we reduced the entire request time to 120s.
DefaultHTTPTimeout = 120
)
var defaultOptions = []Option{WithTimeout(time.Second * DefaultHTTPTimeout)}
var httpProvider = Provider{
Schemes: []string{"http", "https"},
New: NewHTTPGetter,
New: func(options ...Option) (Getter, error) {
options = append(options, defaultOptions...)
return NewHTTPGetter(options...)
},
}
var ociProvider = Provider{

Loading…
Cancel
Save