diff --git a/internal/neofs/tree.go b/internal/neofs/tree.go index 2f5d0581..a7eb2d40 100644 --- a/internal/neofs/tree.go +++ b/internal/neofs/tree.go @@ -4,6 +4,7 @@ import ( "context" "errors" "fmt" + "io" "strconv" "strings" @@ -406,6 +407,14 @@ func (c *TreeClient) getParent(ctx context.Context, cnrID *cid.ID, treeID string return 0, fmt.Errorf("failed to get sub tree: %w", err) } + for { + if _, err = cli.Recv(); err == io.EOF { + break + } else if err != nil { + return 0, fmt.Errorf("failed to read out sub tree stream: %w", err) + } + } + return resp.GetBody().GetParentId(), nil }