diff --git a/internal/frostfs/services/tree_client_grpc.go b/internal/frostfs/services/tree_client_grpc.go index 11acc05..fda70db 100644 --- a/internal/frostfs/services/tree_client_grpc.go +++ b/internal/frostfs/services/tree_client_grpc.go @@ -17,8 +17,6 @@ import ( "github.com/nspcc-dev/neo-go/pkg/crypto/keys" "go.uber.org/zap" "google.golang.org/grpc" - "google.golang.org/grpc/codes" - "google.golang.org/grpc/status" ) type GetNodeByPathResponseInfoWrapper struct { @@ -345,31 +343,9 @@ func (c *ServiceClientGRPC) requestWithRetry(fn func(client treeClient) error) ( } func shouldTryAgain(err error) bool { - if err == nil { - return false - } - - code := status.Code(unwrapErr(err)) - if code == codes.Unavailable || code == codes.Unimplemented { - return true - } - - errText := err.Error() - if strings.Contains(errText, "not found") || - strings.Contains(errText, "shard is in read-only mode") || - strings.Contains(errText, "shard is in degraded mode") { - return true - } - - return false -} - -func unwrapErr(err error) error { - for e := errors.Unwrap(err); e != nil; e = errors.Unwrap(err) { - err = e - } - - return err + return !(err == nil || + errors.Is(err, tree.ErrNodeNotFound) || + errors.Is(err, tree.ErrNodeAccessDenied)) } func metaToKV(meta map[string]string) []*grpcService.KeyValue {