Skip to content

Commit ca3bc61

Browse files
committed
fix: ignore some errors so that we don't spam the logs
Fixes #1 In closing state, it's not possible to send errors back, and that is fine. Signed-off-by: Andrey Smirnov <[email protected]>
1 parent 5c579a7 commit ca3bc61

File tree

1 file changed

+9
-0
lines changed

1 file changed

+9
-0
lines changed

proxy/handler_one2many.go

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,7 @@
44
package proxy
55

66
import (
7+
"context"
78
"errors"
89
"fmt"
910
"io"
@@ -83,6 +84,14 @@ func (s *handler) sendError(src *backendConnection, dst grpc.ServerStream, backe
8384

8485
f := &frame{payload: payload}
8586
if err = dst.SendMsg(f); err != nil {
87+
if errors.Is(err, context.Canceled) {
88+
return nil
89+
}
90+
91+
if rpcStatus, ok := status.FromError(err); ok && rpcStatus.Message() == "transport is closing" {
92+
return nil
93+
}
94+
8695
return fmt.Errorf("error sending error back: %w", err)
8796
}
8897

0 commit comments

Comments
 (0)