Skip to content

Commit

Permalink
fix: terminate idle connections (#845)
Browse files Browse the repository at this point in the history
  • Loading branch information
alexplischke authored Oct 24, 2023
1 parent cd82237 commit abbff11
Showing 1 changed file with 8 additions and 2 deletions.
10 changes: 8 additions & 2 deletions internal/http/webdriver.go
Original file line number Diff line number Diff line change
Expand Up @@ -94,8 +94,14 @@ type sessionStartResponse struct {
func NewWebdriver(url string, creds iam.Credentials, timeout time.Duration) Webdriver {
return Webdriver{
HTTPClient: &http.Client{
Timeout: timeout,
Transport: &http.Transport{Proxy: http.ProxyFromEnvironment},
Timeout: timeout,
Transport: &http.Transport{
Proxy: http.ProxyFromEnvironment,
// The server seems to terminate idle connections within 10 minutes,
// without any Keep-Alive information. We need to stay ahead of
// the server side disconnect.
IdleConnTimeout: 3 * time.Minute,
},
CheckRedirect: func(req *http.Request, via []*http.Request) error {
// Sauce can queue up Job start requests for up to 10 minutes and sends redirects in the meantime to
// keep the connection alive. A redirect is sent every 45 seconds.
Expand Down

0 comments on commit abbff11

Please sign in to comment.