Pull request 2230: home: incr timeout

Updates #7041.

Squashed commit of the following:

commit 536382cf55bd158f179aaeabb1a16ed86d437257
Author: Ainar Garipov <A.Garipov@AdGuard.COM>
Date:   Tue Jun 4 20:56:56 2024 +0300

    home: incr timeout
This commit is contained in:
Ainar Garipov 2024-06-04 21:06:11 +03:00
parent b69890b8fe
commit 4392255d7e
3 changed files with 11 additions and 3 deletions

View File

@ -23,6 +23,14 @@ See also the [v0.107.51 GitHub milestone][ms-v0.107.51].
NOTE: Add new changes BELOW THIS COMMENT. NOTE: Add new changes BELOW THIS COMMENT.
--> -->
### Changed
- The HTTP server's write timeout has been increased from 1 minute to 5 minutes
to match the one used by AdGuard Home's HTTP client to fetch filtering-list
data ([#7041]).
[#7041]: https://github.com/AdguardTeam/AdGuardHome/issues/7041
<!-- <!--
NOTE: Add new changes ABOVE THIS COMMENT. NOTE: Add new changes ABOVE THIS COMMENT.
--> -->

View File

@ -6,7 +6,6 @@ import (
"net" "net"
"net/http" "net/http"
"net/url" "net/url"
"time"
) )
// httpClient returns a new HTTP client that uses the AdGuard Home's own DNS // httpClient returns a new HTTP client that uses the AdGuard Home's own DNS
@ -23,7 +22,7 @@ func httpClient() (c *http.Client) {
return &http.Client{ return &http.Client{
// TODO(a.garipov): Make configurable. // TODO(a.garipov): Make configurable.
Timeout: time.Minute * 5, Timeout: writeTimeout,
Transport: &http.Transport{ Transport: &http.Transport{
DialContext: dialContext, DialContext: dialContext,
Proxy: httpProxy, Proxy: httpProxy,

View File

@ -23,6 +23,7 @@ import (
"golang.org/x/net/http2/h2c" "golang.org/x/net/http2/h2c"
) )
// TODO(a.garipov): Make configurable.
const ( const (
// readTimeout is the maximum duration for reading the entire request, // readTimeout is the maximum duration for reading the entire request,
// including the body. // including the body.
@ -31,7 +32,7 @@ const (
readHdrTimeout = 60 * time.Second readHdrTimeout = 60 * time.Second
// writeTimeout is the maximum duration before timing out writes of the // writeTimeout is the maximum duration before timing out writes of the
// response. // response.
writeTimeout = 60 * time.Second writeTimeout = 5 * time.Minute
) )
type webConfig struct { type webConfig struct {