forked from TrueCloudLab/frostfs-node
[#1671] Use min
builtin where possible
Signed-off-by: Evgenii Stratonikov <e.stratonikov@yadro.com>
This commit is contained in:
parent
40536d8a06
commit
155d3ddb6e
2 changed files with 2 additions and 8 deletions
|
@ -205,10 +205,7 @@ func (f *memoryForest) TreeSortedByFilename(_ context.Context, cid cid.ID, treeI
|
|||
r := mergeNodeInfos(res)
|
||||
for i := range r {
|
||||
if start == nil || string(findAttr(r[i].Meta, AttributeFilename)) > *start {
|
||||
finish := i + count
|
||||
if len(res) < finish {
|
||||
finish = len(res)
|
||||
}
|
||||
finish := min(len(res), i+count)
|
||||
last := string(findAttr(r[finish-1].Meta, AttributeFilename))
|
||||
return r[i:finish], &last, nil
|
||||
}
|
||||
|
|
|
@ -262,10 +262,7 @@ func (c *Client) TestInvokeIterator(cb func(stackitem.Item) error, batchSize int
|
|||
}()
|
||||
|
||||
// Batch size for TraverseIterator() can restricted on the server-side.
|
||||
traverseBatchSize := batchSize
|
||||
if invoker.DefaultIteratorResultItems < traverseBatchSize {
|
||||
traverseBatchSize = invoker.DefaultIteratorResultItems
|
||||
}
|
||||
traverseBatchSize := min(batchSize, invoker.DefaultIteratorResultItems)
|
||||
for {
|
||||
items, err := c.rpcActor.TraverseIterator(sid, &r, traverseBatchSize)
|
||||
if err != nil {
|
||||
|
|
Loading…
Add table
Reference in a new issue