From 64dc62b934d6881568aee122e562fff732f8932c Mon Sep 17 00:00:00 2001 From: AlexKuznicki Date: Sun, 23 Jun 2024 15:29:51 -0600 Subject: [PATCH] cleanup --- .../services/relay/evm/mercury/wsrpc/cache/helpers_test.go | 4 ---- core/services/relay/evm/mercury/wsrpc/client.go | 7 +++---- 2 files changed, 3 insertions(+), 8 deletions(-) diff --git a/core/services/relay/evm/mercury/wsrpc/cache/helpers_test.go b/core/services/relay/evm/mercury/wsrpc/cache/helpers_test.go index 89515f97ddb..f0211269a2f 100644 --- a/core/services/relay/evm/mercury/wsrpc/cache/helpers_test.go +++ b/core/services/relay/evm/mercury/wsrpc/cache/helpers_test.go @@ -17,10 +17,6 @@ func (m *mockClient) RawLatestReport(ctx context.Context, req *pb.LatestReportRe return m.resp, m.err } -//func (m *mockClient) LatestReport(ctx context.Context, req *pb.LatestReportRequest) (resp *pb.LatestReportResponse, err error) { -// return m.resp, m.err -//} - func (m *mockClient) ServerURL() string { return "mock client url" } diff --git a/core/services/relay/evm/mercury/wsrpc/client.go b/core/services/relay/evm/mercury/wsrpc/client.go index 53359d4589b..9cc9e23c67e 100644 --- a/core/services/relay/evm/mercury/wsrpc/client.go +++ b/core/services/relay/evm/mercury/wsrpc/client.go @@ -259,7 +259,7 @@ func (w *client) Transmit(ctx context.Context, req *pb.TransmitRequest) (resp *p return nil, errors.Wrap(err, "Transmit call failed") } resp, err = w.rawClient.Transmit(ctx, req) - w.handleWSClientError(err) + w.handleTimeout(err) if err != nil { w.logger.Warnw("Transmit call failed due to networking error", "err", err, "resp", resp) incRequestStatusMetric(statusFailed) @@ -271,7 +271,7 @@ func (w *client) Transmit(ctx context.Context, req *pb.TransmitRequest) (resp *p return } -func (w *client) handleWSClientError(err error) { +func (w *client) handleTimeout(err error) { if errors.Is(err, context.DeadlineExceeded) { w.timeoutCountMetric.Inc() cnt := w.consecutiveTimeoutCnt.Add(1) @@ -298,7 +298,6 @@ func (w *client) handleWSClientError(err error) { // Debug log in case my reasoning is wrong. w.logger.Debugf("Transport is resetting, cnt=%d", cnt) } - return } } else { w.consecutiveTimeoutCnt.Store(0) @@ -308,7 +307,7 @@ func (w *client) handleWSClientError(err error) { func (w *client) RawLatestReport(ctx context.Context, req *pb.LatestReportRequest) (resp *pb.LatestReportResponse, err error) { resp, err = w.rawClient.LatestReport(ctx, req) - w.handleWSClientError(err) + w.handleTimeout(err) return }