From b99e582de0f552c60be7d22247d060212cafe2d0 Mon Sep 17 00:00:00 2001 From: kartlee Date: Wed, 17 Jun 2020 05:44:11 -0400 Subject: [PATCH] Retry dial and connection errors for grpc stream. (#308) --- interceptors/retry/retry.go | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/interceptors/retry/retry.go b/interceptors/retry/retry.go index 90e04360d..c171b2621 100644 --- a/interceptors/retry/retry.go +++ b/interceptors/retry/retry.go @@ -192,9 +192,13 @@ func (s *serverStreamingRetryingStream) RecvMsg(m interface{}) error { callCtx := perCallContext(s.parentCtx, s.callOpts, attempt) newStream, err := s.reestablishStreamAndResendBuffer(callCtx) if err != nil { - // TODO(mwitkow): Maybe dial and transport errors should be retriable? + // Retry dial and transport errors of establishing stream as grpc doesn't retry. + if isRetriable(err, s.callOpts) { + continue + } return err } + s.setStream(newStream) attemptRetry, lastErr = s.receiveMsgAndIndicateRetry(m) //fmt.Printf("Received message and indicate: %v %v\n", attemptRetry, lastErr)