diff --git a/internal/frostfs/services/tree_client_grpc.go b/internal/frostfs/services/tree_client_grpc.go index a6a3c99a..9e544c9a 100644 --- a/internal/frostfs/services/tree_client_grpc.go +++ b/internal/frostfs/services/tree_client_grpc.go @@ -18,8 +18,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 { @@ -346,31 +344,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 {