mirror of
https://github.com/christianselig/apollo-backend
synced 2024-11-25 13:17:42 +00:00
explicitly use http2
This commit is contained in:
parent
c6903d2b5f
commit
164652e2e4
1 changed files with 5 additions and 6 deletions
|
@ -2,7 +2,6 @@ package reddit
|
||||||
|
|
||||||
import (
|
import (
|
||||||
"context"
|
"context"
|
||||||
"crypto/tls"
|
|
||||||
"fmt"
|
"fmt"
|
||||||
"io"
|
"io"
|
||||||
"net/http"
|
"net/http"
|
||||||
|
@ -15,6 +14,7 @@ import (
|
||||||
"github.com/DataDog/datadog-go/statsd"
|
"github.com/DataDog/datadog-go/statsd"
|
||||||
"github.com/go-redis/redis/v8"
|
"github.com/go-redis/redis/v8"
|
||||||
"github.com/valyala/fastjson"
|
"github.com/valyala/fastjson"
|
||||||
|
"golang.org/x/net/http2"
|
||||||
)
|
)
|
||||||
|
|
||||||
const (
|
const (
|
||||||
|
@ -96,11 +96,10 @@ func NewClient(id, secret string, statsd statsd.ClientInterface, redis *redis.Cl
|
||||||
},
|
},
|
||||||
}
|
}
|
||||||
|
|
||||||
t := http.DefaultTransport.(*http.Transport).Clone()
|
t := &http2.Transport{
|
||||||
t.MaxIdleConns = connLimit / 2
|
//TLSClientConfig: &tls.Config{InsecureSkipVerify: true}, // TODO(andremedeiros): remove
|
||||||
t.MaxConnsPerHost = connLimit
|
}
|
||||||
t.MaxIdleConnsPerHost = 100
|
|
||||||
t.TLSClientConfig = &tls.Config{InsecureSkipVerify: true} // TODO(andremedeiros): remove
|
|
||||||
client := &http.Client{
|
client := &http.Client{
|
||||||
Timeout: 5 * time.Second,
|
Timeout: 5 * time.Second,
|
||||||
Transport: t,
|
Transport: t,
|
||||||
|
|
Loading…
Reference in a new issue