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

refactor(server): use time.Duration for timeout values

Instead of converting at the very last moment,
it's simpler and more readable to use time.Duration ASAP.
This commit is contained in:
gudvinr 2025-08-18 23:10:18 +03:00 committed by Frédéric Guillot
parent ed3bf59356
commit 71af68becd
4 changed files with 20 additions and 11 deletions

View file

@ -77,7 +77,7 @@ const (
defaultHTTPClientTimeout = 20
defaultHTTPClientMaxBodySize = 15
defaultHTTPClientProxy = ""
defaultHTTPServerTimeout = 300
defaultHTTPServerTimeout = 300 * time.Second
defaultAuthProxyHeader = ""
defaultAuthProxyUserCreation = false
defaultMaintenanceMode = false
@ -170,7 +170,7 @@ type options struct {
httpClientProxyURL *url.URL
httpClientProxies []string
httpClientUserAgent string
httpServerTimeout int
httpServerTimeout time.Duration
authProxyHeader string
authProxyUserCreation bool
maintenanceMode bool
@ -617,8 +617,8 @@ func (o *options) HasHTTPClientProxiesConfigured() bool {
return len(o.httpClientProxies) > 0
}
// HTTPServerTimeout returns the time limit in seconds before the HTTP server cancel the request.
func (o *options) HTTPServerTimeout() int {
// HTTPServerTimeout returns the time limit before the HTTP server cancel the request.
func (o *options) HTTPServerTimeout() time.Duration {
return o.httpServerTimeout
}
@ -745,7 +745,7 @@ func (o *options) SortedOptions(redactSecret bool) []*option {
"HTTP_CLIENT_PROXY": clientProxyURLRedacted,
"HTTP_CLIENT_TIMEOUT": o.httpClientTimeout,
"HTTP_CLIENT_USER_AGENT": o.httpClientUserAgent,
"HTTP_SERVER_TIMEOUT": o.httpServerTimeout,
"HTTP_SERVER_TIMEOUT": int(o.httpServerTimeout.Seconds()),
"HTTP_SERVICE": o.httpService,
"INVIDIOUS_INSTANCE": o.invidiousInstance,
"KEY_FILE": o.certKeyFile,