From 102cbb2ee2c22fd82686bfb11b1d725b250b43b7 Mon Sep 17 00:00:00 2001 From: Andre Medeiros Date: Fri, 15 Jul 2022 12:34:28 -0400 Subject: [PATCH] setup timeouts on reddit http client --- internal/reddit/client.go | 15 ++++----------- 1 file changed, 4 insertions(+), 11 deletions(-) diff --git a/internal/reddit/client.go b/internal/reddit/client.go index 57376da..84ee0bf 100644 --- a/internal/reddit/client.go +++ b/internal/reddit/client.go @@ -88,17 +88,10 @@ func NewClient(id, secret string, statsd statsd.ClientInterface, redis *redis.Cl }, } - /* - t := http.DefaultTransport.(*http.Transport).Clone() - t.MaxIdleConns = connLimit / 4 / 100 - t.MaxConnsPerHost = connLimit / 100 - t.MaxIdleConnsPerHost = connLimit / 4 / 100 - t.IdleConnTimeout = 60 * time.Second - t.ResponseHeaderTimeout = 5 * time.Second - - client := &http.Client{Transport: t} - */ - client := &http.Client{} + t := http.DefaultTransport.(*http.Transport).Clone() + t.IdleConnTimeout = 60 * time.Second + t.ResponseHeaderTimeout = 5 * time.Second + client := &http.Client{Transport: t} pool := &fastjson.ParserPool{}