hashicorp / hashicorp/go-retryablehttp

Feature Request: Add Timeout Setting for Idle Connections (IdleConnTimeout)

Open
#213 0 comments 3 reactions 0 assignees View on GitHub
Dominant language
Go
Stars
2.3k
Forks
298
PR merge metrics
No merged PRs in 30d

Description

The `retryablehttp` package utilizes keepalive connections.
It is critical to be able to set a timeout for idle keepalive connections, as the server might time out a connection at the same moment a client sends a request over what it believes to be an active connection. This would result in the client receiving some kind of error.
To prevent such errors, one approach is to set the client’s keepalive timeout shorter than the server’s timeout. Currently, in `retryablehttp`, one must write implementation-dependent code like this:

```go
aClientInstance.HTTPClient.Transport.(*http.Transport).IdleConnTimeout = 10 * time.Second
```

The fact that `retryablehttp.HTTPClient.Transport` is set to a `*http.Transport` is an implementation detail and not guaranteed to stay the same in future.
Therefore, I would like to request a feature that allows setting the timeout for idle keepalive connections without relying on the specific implementation.

Thank you in advance for considering this feature request.

Contributor guide

No contributing guide indexed for this repository

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.