Skip to content

Commit 41370f6

Browse files
authored
Merge pull request #575 from ydb-platform/unauthenticated
* Added exit from retryer if got grpc-error `Unauthenticated` on `dis…
2 parents e1b5dc7 + 3380956 commit 41370f6

File tree

2 files changed

+7
-1
lines changed

2 files changed

+7
-1
lines changed

CHANGELOG.md

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,5 @@
1+
* Added exit from retryer if got grpc-error `Unauthenticated` on `discovery/ListEndpoints` call
2+
13
## v3.42.9
24
* Added `internal/xerrors.Errorf` error for wrap multiple errors and check them with `errors.Is` of `errors.As`
35
* Fixed corner cases of `internal/wait.Wait`

internal/balancer/balancer.go

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,7 @@ import (
55
"fmt"
66

77
"google.golang.org/grpc"
8+
grpcCodes "google.golang.org/grpc/codes"
89

910
"github.com/ydb-platform/ydb-go-sdk/v3/config"
1011
"github.com/ydb-platform/ydb-go-sdk/v3/discovery"
@@ -51,8 +52,11 @@ func (b *Balancer) OnUpdate(onApplyDiscoveredEndpoints func(ctx context.Context,
5152
func (b *Balancer) clusterDiscovery(ctx context.Context) (err error) {
5253
if err = retry.Retry(ctx, func(childCtx context.Context) (err error) {
5354
if err = b.clusterDiscoveryAttempt(childCtx); err != nil {
55+
if xerrors.IsTransportError(err, grpcCodes.Unauthenticated) {
56+
return xerrors.WithStackTrace(err)
57+
}
5458
// if got err but parent context is not done - mark error as retryable
55-
if err != nil && ctx.Err() == nil && xerrors.IsTimeoutError(err) {
59+
if ctx.Err() == nil && xerrors.IsTimeoutError(err) {
5660
return xerrors.WithStackTrace(xerrors.Retryable(err))
5761
}
5862
return xerrors.WithStackTrace(err)

0 commit comments

Comments
 (0)