Skip to content

Commit 7671c55

Browse files
authored
Merge pull request #109 from arangodb-helper/shard-http-client
Use shared HTTP client to prevent rising number of file descriptors
2 parents 6be4cbb + 1b0d074 commit 7671c55

File tree

2 files changed

+10
-2
lines changed

2 files changed

+10
-2
lines changed

client/client.go

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -38,10 +38,14 @@ func NewArangoStarterClient(endpoint url.URL) (API, error) {
3838
endpoint.Path = ""
3939
return &client{
4040
endpoint: endpoint,
41-
client: DefaultHTTPClient(),
41+
client: shardHTTPClient,
4242
}, nil
4343
}
4444

45+
var (
46+
shardHTTPClient = DefaultHTTPClient()
47+
)
48+
4549
type client struct {
4650
endpoint url.URL
4751
client *http.Client

service/arangod/client.go

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -41,7 +41,7 @@ func NewServerClient(endpoint url.URL, prepareRequest func(*http.Request) error,
4141
endpoint.Path = ""
4242
c := &client{
4343
endpoint: endpoint,
44-
client: DefaultHTTPClient(),
44+
client: shardHTTPClient,
4545
prepareRequest: prepareRequest,
4646
}
4747
if !followRedirects {
@@ -52,6 +52,10 @@ func NewServerClient(endpoint url.URL, prepareRequest func(*http.Request) error,
5252
return c, nil
5353
}
5454

55+
var (
56+
shardHTTPClient = DefaultHTTPClient()
57+
)
58+
5559
type client struct {
5660
endpoint url.URL
5761
client *http.Client

0 commit comments

Comments
 (0)