@@ -22,13 +22,13 @@ import (
22
22
"context"
23
23
"fmt"
24
24
"math"
25
- "net"
26
25
"net/http"
27
26
"strconv"
28
27
"strings"
29
28
"time"
30
29
31
30
"github.com/aws/aws-sdk-go-v2/aws"
31
+ awshttp "github.com/aws/aws-sdk-go-v2/aws/transport/http"
32
32
"github.com/aws/aws-sdk-go-v2/config"
33
33
"github.com/aws/aws-sdk-go-v2/service/timestreamquery"
34
34
"github.com/aws/aws-sdk-go-v2/service/timestreamwrite"
@@ -82,25 +82,18 @@ func newTimestreamQueryPaginator(client TimestreamQueryApi, params *timestreamqu
82
82
}
83
83
84
84
func newTimeStreamAdapter (ctx context.Context , logger * zap.SugaredLogger , cfg * adapterCfg , newQueryPaginator NewQueryPaginator , writeSvc * timestreamwrite.Client , querySvc * timestreamquery.Client ) TimeStreamAdapter {
85
- tr := & http.Transport {
86
- ResponseHeaderTimeout : 20 * time .Second ,
87
- // Using DefaultTransport values for other parameters: https://golang.org/pkg/net/http/#RoundTripper
88
- Proxy : http .ProxyFromEnvironment ,
89
- DialContext : (& net.Dialer {
90
- KeepAlive : 30 * time .Second ,
91
- Timeout : 30 * time .Second ,
92
- }).DialContext ,
93
- MaxIdleConns : 100 ,
94
- IdleConnTimeout : 90 * time .Second ,
95
- TLSHandshakeTimeout : 10 * time .Second ,
96
- ExpectContinueTimeout : 1 * time .Second ,
97
- }
85
+ if writeSvc == nil || querySvc == nil {
86
+ client := awshttp .NewBuildableClient ().WithTransportOptions (func (tr * http.Transport ) {
87
+ tr .ResponseHeaderTimeout = 20 * time .Second
98
88
99
- // So client makes HTTP/2 requests
100
- _ = http2 .ConfigureTransport (tr )
89
+ // Enable HTTP/2
90
+ err := http2 .ConfigureTransport (tr )
91
+ if err != nil {
92
+ logger .Fatalw ("Unable to configure HTTP/2 transport" , "error" , err )
93
+ }
94
+ })
101
95
102
- if writeSvc == nil || querySvc == nil {
103
- awsCfg , err := config .LoadDefaultConfig (ctx , config .WithRegion (cfg .awsRegion ))
96
+ awsCfg , err := config .LoadDefaultConfig (ctx , config .WithRegion (cfg .awsRegion ), config .WithHTTPClient (client ), config .WithRetryMaxAttempts (10 ))
104
97
if err != nil {
105
98
logger .Fatalw ("Unable to load AWS SDK config" , "error" , err )
106
99
}
0 commit comments