1
0
Fork 0
mirror of https://github.com/miniflux/v2.git synced 2025-08-26 18:21:01 +00:00

refactor(fetcher): use time.Duration for client timeout values

All functions use time.Duration, so instead of converting everywhere, do it once.
This commit is contained in:
gudvinr 2025-08-18 23:10:18 +03:00 committed by Frédéric Guillot
parent 71af68becd
commit 30453ad7ec
5 changed files with 51 additions and 22 deletions

View file

@ -18,14 +18,14 @@ import (
)
const (
defaultHTTPClientTimeout = 20
defaultHTTPClientTimeout = 20 * time.Second
defaultAcceptHeader = "application/xml, application/atom+xml, application/rss+xml, application/rdf+xml, application/feed+json, text/html, */*;q=0.9"
)
type RequestBuilder struct {
headers http.Header
clientProxyURL *url.URL
clientTimeout int
clientTimeout time.Duration
useClientProxy bool
withoutRedirects bool
ignoreTLSErrors bool
@ -104,7 +104,7 @@ func (r *RequestBuilder) WithCustomFeedProxyURL(proxyURL string) *RequestBuilder
return r
}
func (r *RequestBuilder) WithTimeout(timeout int) *RequestBuilder {
func (r *RequestBuilder) WithTimeout(timeout time.Duration) *RequestBuilder {
r.clientTimeout = timeout
return r
}
@ -185,7 +185,7 @@ func (r *RequestBuilder) ExecuteRequest(requestURL string) (*http.Response, erro
}
client := &http.Client{
Timeout: time.Duration(r.clientTimeout) * time.Second,
Timeout: r.clientTimeout,
}
if r.withoutRedirects {