[#1000] morph: Fix batch size in TraverseIterator()

Initial prefetch size can be arbitrary an restricted only by VM/RPC
limits. For TraverseIterator() there is an explicit check on the
server-side, though.
Introduced in df055fead5.
Refs #931.

Signed-off-by: Evgenii Stratonikov <e.stratonikov@yadro.com>
This commit is contained in:
Evgenii Stratonikov 2024-02-21 15:22:50 +03:00 committed by Evgenii Stratonikov
parent e18f0f5178
commit 4b13b85173

View file

@ -260,8 +260,13 @@ func (c *Client) TestInvokeIterator(cb func(stackitem.Item) error, batchSize int
_ = c.rpcActor.TerminateSession(sid)
}()
// Batch size for TraverseIterator() can restricted on the server-side.
traverseBatchSize := batchSize
if invoker.DefaultIteratorResultItems < traverseBatchSize {
traverseBatchSize = invoker.DefaultIteratorResultItems
}
for {
items, err := c.rpcActor.TraverseIterator(sid, &r, batchSize)
items, err := c.rpcActor.TraverseIterator(sid, &r, traverseBatchSize)
if err != nil {
return err
}
@ -271,7 +276,7 @@ func (c *Client) TestInvokeIterator(cb func(stackitem.Item) error, batchSize int
return err
}
}
if len(items) < batchSize {
if len(items) < traverseBatchSize {
break
}
}