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

Avoid retrying requests finished with 'UNAUTHORIZED' errors #1563

Merged
merged 4 commits into from
Nov 17, 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
3 changes: 2 additions & 1 deletion CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,11 +1,12 @@
* Avoid retrying requests finished with 'UNAUTHORIZED' errors

## v3.92.4
* Fixed connections pool leak on closing

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


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

Expand Down
10 changes: 9 additions & 1 deletion internal/pool/pool.go
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@ import (
"time"

"github.com/jonboulle/clockwork"
"github.com/ydb-platform/ydb-go-genproto/protos/Ydb"

"github.com/ydb-platform/ydb-go-sdk/v3/internal/endpoint"
"github.com/ydb-platform/ydb-go-sdk/v3/internal/stack"
Expand Down Expand Up @@ -339,7 +340,14 @@ func (p *Pool[PT, T]) try(ctx context.Context, f func(ctx context.Context, item
item, err := p.getItem(ctx)
if err != nil {
if xerrors.IsYdb(err) {
return xerrors.WithStackTrace(xerrors.Retryable(err))
switch {
case xerrors.IsOperationError(err, Ydb.StatusIds_UNAUTHORIZED):
// https://github.com/ydb-platform/ydb-go-sdk/issues/1550
// Avoid retrying UNAUTHORIZED errors.
return xerrors.WithStackTrace(xerrors.Unretryable(err))
default:
return xerrors.WithStackTrace(xerrors.Retryable(err))
}
}

return xerrors.WithStackTrace(err)
Expand Down
Loading