Skip to content

Commit 99bf3b6

Browse files
authored
httpclient conn pool and request timeout config (#124)
1 parent 14188ee commit 99bf3b6

File tree

1 file changed

+7
-1
lines changed

1 file changed

+7
-1
lines changed

pkg/ec2metadata/ec2metadata.go

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -103,7 +103,13 @@ func New(metadataURL string, tries int) *Service {
103103
return &Service{
104104
metadataURL: metadataURL,
105105
tries: tries,
106-
httpClient: http.Client{},
106+
httpClient: http.Client{
107+
Timeout: 5 * time.Second,
108+
Transport: &http.Transport{
109+
MaxIdleConns: 10,
110+
IdleConnTimeout: 30 * time.Second,
111+
},
112+
},
107113
}
108114
}
109115

0 commit comments

Comments
 (0)