Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 5 additions & 5 deletions util/headerreader/blob_client.go
Original file line number Diff line number Diff line change
Expand Up @@ -214,11 +214,11 @@ func (b *BlobClient) GetBlobsBySlot(ctx context.Context, slot uint64, versionedH
blobs, err = b.getBlobs(ctx, slot, versionedHashes)
}
if err != nil {
// Creates a new http client to avoid reusing the same transport layer connection in the next request.
// This strategy can be useful if there is a network load balancer in front of the beacon chain server.
// So supposing that the error is due to a malfunctioning beacon chain node, by creating a new http client
// we can potentially connect to a different, and healthy, beacon chain node in the next request.
b.httpClient.Store(&http.Client{})
// Create a new HTTP client with a dedicated transport that disables connection reuse.
// With the default client (nil Transport), Go reuses the global DefaultTransport and its connection pool,
// which may keep using the same problematic backend connection. Disabling keep-alives forces a fresh TCP
// connection on the next request, increasing the chance of hitting a healthy backend behind a load balancer.
b.httpClient.Store(&http.Client{Transport: &http.Transport{DisableKeepAlives: true}})

b.useLegacyEndpoint = !b.useLegacyEndpoint

Expand Down
Loading