Skip to content

Commit 7139c17

Browse files
Apply suggestions from code review
Co-authored-by: coderabbitai[bot] <136622811+coderabbitai[bot]@users.noreply.github.com> Signed-off-by: Yusuke Kato <[email protected]>
1 parent 288aec0 commit 7139c17

File tree

2 files changed

+4
-2
lines changed

2 files changed

+4
-2
lines changed

internal/net/grpc/client.go

+3-1
Original file line numberDiff line numberDiff line change
@@ -1125,7 +1125,9 @@ func (g *gRPCClient) rangeConns(ctx context.Context, fn func(addr string, p pool
11251125
pc, err := p.Connect(ctx)
11261126
if pc == nil || err != nil || !pc.IsHealthy(ctx) {
11271127
if pc != nil {
1128-
pc.Disconnect(ctx)
1128+
if derr := pc.Disconnect(ctx); derr != nil {
1129+
log.Debugf("Failed to disconnect unhealthy connection for %s: %v", addr, derr)
1130+
}
11291131
}
11301132
log.Debugf("Unhealthy connection detected for %s during gRPC Connection Range over Loop:\t%s", addr, p.String())
11311133
return true

internal/net/grpc/client_test.go

+1-1
Original file line numberDiff line numberDiff line change
@@ -3107,7 +3107,7 @@ package grpc
31073107
// stopMonitor: test.fields.stopMonitor,
31083108
// }
31093109
//
3110-
// gotAddrs := g.ConnectedAddrs(context.Background)
3110+
gotAddrs := g.ConnectedAddrs(context.Background())
31113111
// if err := checkFunc(test.want, gotAddrs); err != nil {
31123112
// tt.Errorf("error = %v", err)
31133113
// }

0 commit comments

Comments
 (0)