From 25a061f44e81661a79b823d14465053bf54cb4c3 Mon Sep 17 00:00:00 2001 From: sentriz Date: Tue, 17 Feb 2026 15:36:20 +0000 Subject: [PATCH] fix(listenbrainz): disable keep-alive to avoid connection reset errors --- listenbrainz/listenbrainz.go | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/listenbrainz/listenbrainz.go b/listenbrainz/listenbrainz.go index 8d1da45..1bd5082 100644 --- a/listenbrainz/listenbrainz.go +++ b/listenbrainz/listenbrainz.go @@ -30,7 +30,13 @@ type Client struct { } func NewClient() *Client { - return NewClientCustom(http.DefaultClient) + // disable keep-alive to avoid "connection reset by peer" errors caused by a race between + // the server closing idle connections and the client reusing them for new requests + return NewClientCustom(&http.Client{ + Transport: &http.Transport{ + DisableKeepAlives: true, + }, + }) } func NewClientCustom(httpClient *http.Client) *Client {