diff --git a/internal/neofs/tree.go b/internal/neofs/tree.go index 2f5d05813..a7eb2d40d 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 }