Skip to content

Commit

Permalink
address comments
Browse files Browse the repository at this point in the history
Signed-off-by: Ryan Leung <rleungx@gmail.com>
  • Loading branch information
rleungx committed Jan 31, 2024
1 parent 691e433 commit 313ec06
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 5 deletions.
5 changes: 1 addition & 4 deletions pkg/utils/grpcutil/grpcutil.go
Original file line number Diff line number Diff line change
Expand Up @@ -252,10 +252,7 @@ func CheckStream(ctx context.Context, cancel context.CancelFunc, done chan struc

// NeedRebuildConnection checks if the error is a connection error.
func NeedRebuildConnection(err error) bool {
if err == nil {
return false
}
return err == io.EOF ||
return err != nil && err == io.EOF ||
strings.Contains(err.Error(), codes.Unavailable.String()) || // Unavailable indicates the service is currently unavailable. This is a most likely a transient condition.
strings.Contains(err.Error(), codes.DeadlineExceeded.String()) || // DeadlineExceeded means operation expired before completion.
strings.Contains(err.Error(), codes.Internal.String()) || // Internal errors.
Expand Down
2 changes: 1 addition & 1 deletion server/forward.go
Original file line number Diff line number Diff line change
Expand Up @@ -159,7 +159,7 @@ func (s *GrpcServer) forwardTSO(stream pdpb.PD_TsoServer) error {
tsopbResp, err := s.forwardTSORequestWithDeadLine(forwardCtx, cancelForward, forwardStream, request, tsDeadlineCh)
if err != nil {
tsoStreamErr = errors.WithStack(err)
return errors.WithStack(err)
return tsoStreamErr
}

// The error types defined for tsopb and pdpb are different, so we need to convert them.
Expand Down

0 comments on commit 313ec06

Please sign in to comment.