Try disabling keep alives

This commit is contained in:
Melon 2023-08-30 13:24:39 +01:00
parent 221a46cc55
commit 6a5be76db3
Signed by: melon
GPG Key ID: 6C9D970C50D26A25
2 changed files with 4 additions and 1 deletions

View File

@ -49,6 +49,7 @@ func NewHybridTransportWithCalls(normal, insecure http.RoundTripper, ws *websock
IdleConnTimeout: 30 * time.Second, IdleConnTimeout: 30 * time.Second,
ExpectContinueTimeout: 1 * time.Second, ExpectContinueTimeout: 1 * time.Second,
ResponseHeaderTimeout: 10 * time.Second, ResponseHeaderTimeout: 10 * time.Second,
DisableKeepAlives: true,
} }
} }
if h.insecureTransport == nil { if h.insecureTransport == nil {
@ -62,6 +63,7 @@ func NewHybridTransportWithCalls(normal, insecure http.RoundTripper, ws *websock
ExpectContinueTimeout: 1 * time.Second, ExpectContinueTimeout: 1 * time.Second,
ResponseHeaderTimeout: 10 * time.Second, ResponseHeaderTimeout: 10 * time.Second,
TLSClientConfig: &tls.Config{InsecureSkipVerify: true}, TLSClientConfig: &tls.Config{InsecureSkipVerify: true},
DisableKeepAlives: true,
} }
} }
return h return h

View File

@ -1,6 +1,7 @@
package utils package utils
import ( import (
"errors"
"log" "log"
"net/http" "net/http"
"strings" "strings"
@ -10,7 +11,7 @@ import (
// RunBackgroundHttp and RunBackgroundHttps. // RunBackgroundHttp and RunBackgroundHttps.
func logHttpServerError(prefix string, err error) { func logHttpServerError(prefix string, err error) {
if err != nil { if err != nil {
if err == http.ErrServerClosed { if errors.Is(err, http.ErrServerClosed) {
log.Printf("[%s] The http server shutdown successfully\n", prefix) log.Printf("[%s] The http server shutdown successfully\n", prefix)
} else { } else {
log.Printf("[%s] Error trying to host the http server: %s\n", prefix, err.Error()) log.Printf("[%s] Error trying to host the http server: %s\n", prefix, err.Error())