forked from TrueCloudLab/frostfs-s3-gw
[#413] Add stream reading
Signed-off-by: Denis Kirillov <denis@nspcc.ru>
This commit is contained in:
parent
1e86413667
commit
332de834ae
1 changed files with 9 additions and 0 deletions
|
@ -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
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in a new issue