Skip to content

Commit 5dc5744

Browse files
dont reuse client because we change the timeout
1 parent d4809e1 commit 5dc5744

File tree

3 files changed

+5
-4
lines changed

3 files changed

+5
-4
lines changed

pkg/throttle/throttler.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -322,7 +322,7 @@ func (throttler *Throttler) refreshMySQLInventory() error {
322322

323323
if !clusterSettings.VitessSettings.IsEmpty() {
324324
if throttler.vitessClient == nil {
325-
throttler.vitessClient = vitess.New(throttler.httpClient)
325+
throttler.vitessClient = vitess.New()
326326
}
327327
log.Debugf("getting vitess data from %s", clusterSettings.VitessSettings.API)
328328
keyspace := clusterSettings.VitessSettings.Keyspace

pkg/vitess/api_client.go

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,7 @@ import (
88
"strings"
99
"time"
1010

11+
"github.com/github/freno/pkg/base"
1112
"vitess.io/vitess/go/vt/proto/topodata"
1213
)
1314

@@ -51,8 +52,8 @@ type Client struct {
5152
}
5253

5354
// New returns a new Client
54-
func New(client *http.Client) *Client {
55-
return &Client{client: client}
55+
func New() *Client {
56+
return &Client{client: base.SetupHttpClient(0)}
5657
}
5758

5859
// ParseTablets reads from vitess /api/ks_tablets/<keyspace>/[shard] and returns a

pkg/vitess/api_client_test.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -50,7 +50,7 @@ func TestParseTablets(t *testing.T) {
5050
}))
5151
defer vitessApi.Close()
5252

53-
vtClient := New(&http.Client{})
53+
vtClient := New()
5454

5555
t.Run("success", func(t *testing.T) {
5656
tablets, err := vtClient.ParseTablets(vitessApi.URL, "test", "00", 1)

0 commit comments

Comments
 (0)