Skip to content

Commit 7ccc177

Browse files
committed
fix PR issues
1 parent 4656781 commit 7ccc177

File tree

2 files changed

+5
-9
lines changed

2 files changed

+5
-9
lines changed

CHANGELOG.md

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
* Added `conn.Ping(ctx)` method for check availability of `conn.Conn`
2-
* Refactored `cluster.Cluster.Get(ctx)` for return only available connection (instead return any connection from balancer)
3-
* Added address to error description which thrown from `conn.take()`
4-
* Renamed package `internal/db` to `internal/database` for exclude collisions with variable name `db`
2+
* Refactored `cluster.Cluster.Get(ctx)` to return only available connection (instead of returning any connection from balancer)
3+
* Added address to error description thrown from `conn.take()`
4+
* Renamed package `internal/db` to `internal/database` to exclude collisions with variable name `db`
55

66
## v3.18.0
77
* Added `go1.18` to test matrix

internal/conn/conn.go

Lines changed: 2 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -228,7 +228,7 @@ func (c *conn) take(ctx context.Context) (cc *grpc.ClientConn, err error) {
228228

229229
cc, err = grpc.DialContext(ctx, address, c.config.GrpcDialOptions()...)
230230
if err != nil {
231-
return nil, errors.WithStackTrace(fmt.Errorf("%w: %s", err, address))
231+
return nil, errors.WithStackTrace(fmt.Errorf("dial %s failed: %w", address, err))
232232
}
233233

234234
c.cc = cc
@@ -286,11 +286,7 @@ func isBroken(raw *grpc.ClientConn) bool {
286286
}
287287

288288
func isAvailable(raw *grpc.ClientConn) bool {
289-
if raw == nil {
290-
return false
291-
}
292-
s := raw.GetState()
293-
return s == connectivity.Ready
289+
return raw != nil && raw.GetState() == connectivity.Ready
294290
}
295291

296292
// conn must be locked

0 commit comments

Comments
 (0)