Skip to content

Commit

Permalink
cleanup
Browse files Browse the repository at this point in the history
  • Loading branch information
akuzni2 committed Jun 23, 2024
1 parent cc742b8 commit 64dc62b
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 8 deletions.
4 changes: 0 additions & 4 deletions core/services/relay/evm/mercury/wsrpc/cache/helpers_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -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"
}
Expand Down
7 changes: 3 additions & 4 deletions core/services/relay/evm/mercury/wsrpc/client.go
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand All @@ -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)
Expand All @@ -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)
Expand All @@ -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
}

Expand Down

0 comments on commit 64dc62b

Please sign in to comment.