From 164652e2e4679a5758515eac732b36995593acec Mon Sep 17 00:00:00 2001 From: Andre Medeiros Date: Wed, 2 Nov 2022 19:05:23 -0400 Subject: [PATCH] explicitly use http2 --- internal/reddit/client.go | 11 +++++------ 1 file changed, 5 insertions(+), 6 deletions(-) diff --git a/internal/reddit/client.go b/internal/reddit/client.go index c3376cc..f2d362b 100644 --- a/internal/reddit/client.go +++ b/internal/reddit/client.go @@ -2,7 +2,6 @@ package reddit import ( "context" - "crypto/tls" "fmt" "io" "net/http" @@ -15,6 +14,7 @@ import ( "github.com/DataDog/datadog-go/statsd" "github.com/go-redis/redis/v8" "github.com/valyala/fastjson" + "golang.org/x/net/http2" ) const ( @@ -96,11 +96,10 @@ func NewClient(id, secret string, statsd statsd.ClientInterface, redis *redis.Cl }, } - t := http.DefaultTransport.(*http.Transport).Clone() - t.MaxIdleConns = connLimit / 2 - t.MaxConnsPerHost = connLimit - t.MaxIdleConnsPerHost = 100 - t.TLSClientConfig = &tls.Config{InsecureSkipVerify: true} // TODO(andremedeiros): remove + t := &http2.Transport{ + //TLSClientConfig: &tls.Config{InsecureSkipVerify: true}, // TODO(andremedeiros): remove + } + client := &http.Client{ Timeout: 5 * time.Second, Transport: t,