From a1898787cf31accf8328a898afc4ac20961b9a45 Mon Sep 17 00:00:00 2001 From: Tsahi Zidenberg Date: Mon, 11 Dec 2023 11:54:41 -0700 Subject: [PATCH 1/2] rpcclient: enable retries by default --- util/rpcclient/rpcclient.go | 2 ++ 1 file changed, 2 insertions(+) diff --git a/util/rpcclient/rpcclient.go b/util/rpcclient/rpcclient.go index 61c125eaed..dee6e9252a 100644 --- a/util/rpcclient/rpcclient.go +++ b/util/rpcclient/rpcclient.go @@ -53,6 +53,8 @@ var TestClientConfig = ClientConfig{ var DefaultClientConfig = ClientConfig{ URL: "self-auth", JWTSecret: "", + Retries: 3, + RetryErrors: "websocket: close.*|dial tcp .*|.*i/o timeout|.*connection reset by peer|.*connection refused", ArgLogLimit: 2048, } From 67d99d315cdcd3769598bc0e84e8a45a5b7d5478 Mon Sep 17 00:00:00 2001 From: Tsahi Zidenberg Date: Mon, 11 Dec 2023 11:54:59 -0700 Subject: [PATCH 2/2] rpcclient: use default config in toxiproxy test --- util/rpcclient/rpcclient_toxiproxy_test.go | 13 +++++-------- 1 file changed, 5 insertions(+), 8 deletions(-) diff --git a/util/rpcclient/rpcclient_toxiproxy_test.go b/util/rpcclient/rpcclient_toxiproxy_test.go index 31385d50d8..647a37d691 100644 --- a/util/rpcclient/rpcclient_toxiproxy_test.go +++ b/util/rpcclient/rpcclient_toxiproxy_test.go @@ -22,15 +22,12 @@ func TestToxiRpcClient(t *testing.T) { Require(t, err) defer proxy.Delete() - config := &ClientConfig{ - URL: "ws://" + proxy.Listen, - Timeout: time.Second * 5, - Retries: 3, - RetryErrors: "websocket: close.*|.* i/o timeout|.*connection reset by peer|dial tcp .*", - RetryDelay: time.Millisecond * 500, - } + config := DefaultClientConfig + config.URL = "ws://" + proxy.Listen + config.Timeout = time.Second * 5 + config.RetryDelay = time.Millisecond * 500 Require(t, config.Validate()) - configFetcher := func() *ClientConfig { return config } + configFetcher := func() *ClientConfig { return &config } client := NewRpcClient(configFetcher, server1)