Reconfigure timeouts
This commit is contained in:
@@ -172,7 +172,7 @@ func (z *ZurgConfig) EnableDownloadCache() bool {
|
|||||||
|
|
||||||
func (z *ZurgConfig) GetRealDebridTimeout() int {
|
func (z *ZurgConfig) GetRealDebridTimeout() int {
|
||||||
if z.RealDebridTimeout == 0 {
|
if z.RealDebridTimeout == 0 {
|
||||||
return 60
|
return 10
|
||||||
}
|
}
|
||||||
return z.RealDebridTimeout
|
return z.RealDebridTimeout
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -201,7 +201,7 @@ func (dl *Downloader) streamFileToResponse(torrent *intTor.Torrent, file *intTor
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
log.Debugf("Started serving file %s", unrestrict.Filename)
|
log.Infof("Started serving file %s%s", unrestrict.Filename, rangeLog)
|
||||||
|
|
||||||
buf := make([]byte, cfg.GetNetworkBufferSize())
|
buf := make([]byte, cfg.GetNetworkBufferSize())
|
||||||
io.CopyBuffer(resp, download.Body, buf)
|
io.CopyBuffer(resp, download.Body, buf)
|
||||||
|
|||||||
@@ -52,9 +52,7 @@ func (e *ApiErrorResponse) Error() string {
|
|||||||
func NewHTTPClient(token string, maxRetries int, timeoutSecs int, ensureIPv6Host bool, cfg config.ConfigInterface, log *logutil.Logger) *HTTPClient {
|
func NewHTTPClient(token string, maxRetries int, timeoutSecs int, ensureIPv6Host bool, cfg config.ConfigInterface, log *logutil.Logger) *HTTPClient {
|
||||||
client := HTTPClient{
|
client := HTTPClient{
|
||||||
bearerToken: token,
|
bearerToken: token,
|
||||||
client: &http.Client{
|
client: &http.Client{},
|
||||||
Timeout: time.Duration(timeoutSecs) * time.Second,
|
|
||||||
},
|
|
||||||
maxRetries: maxRetries,
|
maxRetries: maxRetries,
|
||||||
backoff: func(attempt int) time.Duration {
|
backoff: func(attempt int) time.Duration {
|
||||||
maxDuration := 60
|
maxDuration := 60
|
||||||
@@ -110,7 +108,9 @@ func NewHTTPClient(token string, maxRetries int, timeoutSecs int, ensureIPv6Host
|
|||||||
log: log,
|
log: log,
|
||||||
}
|
}
|
||||||
|
|
||||||
var dialer proxy.Dialer = &net.Dialer{}
|
var dialer proxy.Dialer = &net.Dialer{
|
||||||
|
Timeout: time.Duration(timeoutSecs) * time.Second,
|
||||||
|
}
|
||||||
if proxyURLString := cfg.GetProxy(); proxyURLString != "" {
|
if proxyURLString := cfg.GetProxy(); proxyURLString != "" {
|
||||||
proxyURL, err := url.Parse(proxyURLString)
|
proxyURL, err := url.Parse(proxyURLString)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
@@ -140,7 +140,8 @@ func NewHTTPClient(token string, maxRetries int, timeoutSecs int, ensureIPv6Host
|
|||||||
}
|
}
|
||||||
|
|
||||||
client.client.Transport = &http.Transport{
|
client.client.Transport = &http.Transport{
|
||||||
MaxIdleConns: maxConnections,
|
ResponseHeaderTimeout: time.Duration(timeoutSecs) * time.Second,
|
||||||
|
MaxIdleConns: 0,
|
||||||
MaxConnsPerHost: maxConnections,
|
MaxConnsPerHost: maxConnections,
|
||||||
DialContext: func(ctx context.Context, network, address string) (net.Conn, error) {
|
DialContext: func(ctx context.Context, network, address string) (net.Conn, error) {
|
||||||
if ipv6Address, ok := client.ipv6.Get(address); ok {
|
if ipv6Address, ok := client.ipv6.Get(address); ok {
|
||||||
|
|||||||
Reference in New Issue
Block a user