Skip to content

Commit

Permalink
fix: ignore some errors so that we don't spam the logs
Browse files Browse the repository at this point in the history
Fixes #1

In closing state, it's not possible to send errors back, and that is
fine.

Signed-off-by: Andrey Smirnov <smirnov.andrey@gmail.com>
  • Loading branch information
smira committed Dec 20, 2019
1 parent 5c579a7 commit ca3bc61
Showing 1 changed file with 9 additions and 0 deletions.
9 changes: 9 additions & 0 deletions proxy/handler_one2many.go
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@
package proxy

import (
"context"
"errors"
"fmt"
"io"
Expand Down Expand Up @@ -83,6 +84,14 @@ func (s *handler) sendError(src *backendConnection, dst grpc.ServerStream, backe

f := &frame{payload: payload}
if err = dst.SendMsg(f); err != nil {
if errors.Is(err, context.Canceled) {
return nil
}

if rpcStatus, ok := status.FromError(err); ok && rpcStatus.Message() == "transport is closing" {
return nil
}

return fmt.Errorf("error sending error back: %w", err)
}

Expand Down

0 comments on commit ca3bc61

Please sign in to comment.