Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

client: update retryable connection error logs to warning #150

Merged
merged 1 commit into from
Aug 10, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 1 addition & 7 deletions client/listener.go
Original file line number Diff line number Diff line change
Expand Up @@ -4,9 +4,7 @@ import (
"context"
"errors"
"fmt"
"io"
"net"
"strings"

"github.com/andydunstall/yamux"
"go.uber.org/zap"
Expand Down Expand Up @@ -81,11 +79,7 @@ func (l *listener) AcceptWithContext(ctx context.Context) (net.Conn, error) {
return nil, ErrClosed
}

if err != io.EOF && !strings.Contains(err.Error(), "closed") && !strings.Contains(err.Error(), "reset by peer") {
l.logger.Error("failed to accept conn", zap.Error(err))
} else {
l.logger.Warn("disconnected; reconnecting")
}
l.logger.Warn("disconnected; reconnecting", zap.Error(err))

if err := l.connect(l.closeCtx); err != nil {
return nil, fmt.Errorf("connect: %w", err)
Expand Down
2 changes: 1 addition & 1 deletion client/upstream.go
Original file line number Diff line number Diff line change
Expand Up @@ -146,7 +146,7 @@ func (u *Upstream) connect(ctx context.Context, endpointID string) (*yamux.Sessi
return nil, err
}

u.logger().Error(
u.logger().Warn(
"connect failed; retrying",
zap.String("endpoint-id", endpointID),
zap.String("url", url),
Expand Down
2 changes: 1 addition & 1 deletion go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ module github.com/andydunstall/piko
go 1.22

require (
github.com/andydunstall/yamux v0.1.3
github.com/andydunstall/yamux v0.1.4
github.com/gin-gonic/gin v1.10.0
github.com/goccy/go-yaml v1.12.0
github.com/golang-jwt/jwt/v5 v5.2.1
Expand Down
4 changes: 2 additions & 2 deletions go.sum
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
github.com/andydunstall/yamux v0.1.3 h1:lTNkGpbbVuAttKhnn5W290a1yMWVav3GnijrcHhjuKU=
github.com/andydunstall/yamux v0.1.3/go.mod h1:v4C9l2I4bhYdww+IVgjO0o5rVzxXbx2nneuFDHvyM28=
github.com/andydunstall/yamux v0.1.4 h1:VrcjPsG5gUb8QnUFdHXoJnmFfncnu0wbeEjekZs4M78=
github.com/andydunstall/yamux v0.1.4/go.mod h1:v4C9l2I4bhYdww+IVgjO0o5rVzxXbx2nneuFDHvyM28=
github.com/beorn7/perks v1.0.1 h1:VlbKKnNfV8bJzeqoa4cOKqO6bYr3WgKZxO8Z16+hsOM=
github.com/beorn7/perks v1.0.1/go.mod h1:G2ZrVWU2WbWT9wwq4/hrbKbnv/1ERSJQ0ibhJ6rlkpw=
github.com/bytedance/sonic v1.11.6 h1:oUp34TzMlL+OY1OUWxHqsdkgC/Zfc85zGqw9siXjrc0=
Expand Down
Loading