We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
1 parent 4fff418 commit 25a061fCopy full SHA for 25a061f
1 file changed
listenbrainz/listenbrainz.go
@@ -30,7 +30,13 @@ type Client struct {
30
}
31
32
func NewClient() *Client {
33
- return NewClientCustom(http.DefaultClient)
+ // disable keep-alive to avoid "connection reset by peer" errors caused by a race between
34
+ // the server closing idle connections and the client reusing them for new requests
35
+ return NewClientCustom(&http.Client{
36
+ Transport: &http.Transport{
37
+ DisableKeepAlives: true,
38
+ },
39
+ })
40
41
42
func NewClientCustom(httpClient *http.Client) *Client {
0 commit comments