Skip to content

Commit 568fc10

Browse files
authored
Merge pull request #1563 from ydb-platform/issue_1550_fix
Avoid retrying requests finished with 'UNAUTHORIZED' errors
2 parents 2c755e5 + 7fe857f commit 568fc10

File tree

2 files changed

+11
-2
lines changed

2 files changed

+11
-2
lines changed

CHANGELOG.md

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,12 @@
1+
* Avoid retrying requests finished with 'UNAUTHORIZED' errors
2+
13
## v3.92.4
24
* Fixed connections pool leak on closing
35

46
## v3.92.3
57
* Fixed error with incompleted data returen from transaction.ReadQueryResult method
68
* Added option `query/WithResponsePartLimitSizeBytes(...)` for queries with query service
79

8-
910
## v3.92.2
1011
* Added `table/options.WithShardNodesInfo()` experimental option to get shard nodeId for describe table call
1112

internal/pool/pool.go

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,7 @@ import (
77
"time"
88

99
"github.com/jonboulle/clockwork"
10+
"github.com/ydb-platform/ydb-go-genproto/protos/Ydb"
1011

1112
"github.com/ydb-platform/ydb-go-sdk/v3/internal/endpoint"
1213
"github.com/ydb-platform/ydb-go-sdk/v3/internal/stack"
@@ -339,7 +340,14 @@ func (p *Pool[PT, T]) try(ctx context.Context, f func(ctx context.Context, item
339340
item, err := p.getItem(ctx)
340341
if err != nil {
341342
if xerrors.IsYdb(err) {
342-
return xerrors.WithStackTrace(xerrors.Retryable(err))
343+
switch {
344+
case xerrors.IsOperationError(err, Ydb.StatusIds_UNAUTHORIZED):
345+
// https://github.com/ydb-platform/ydb-go-sdk/issues/1550
346+
// Avoid retrying UNAUTHORIZED errors.
347+
return xerrors.WithStackTrace(xerrors.Unretryable(err))
348+
default:
349+
return xerrors.WithStackTrace(xerrors.Retryable(err))
350+
}
343351
}
344352

345353
return xerrors.WithStackTrace(err)

0 commit comments

Comments
 (0)