container: Reduce iterations through container list #1577
2 changed files with 2 additions and 2 deletions
|
@ -6,7 +6,7 @@ const (
|
||||||
subsection = "container"
|
subsection = "container"
|
||||||
listStreamSubsection = "list_stream"
|
listStreamSubsection = "list_stream"
|
||||||
|
|
||||||
// ContainerBatchSizeDefault represents he maximum amount of containers to send via stream at once.
|
// ContainerBatchSizeDefault represents the maximum amount of containers to send via stream at once.
|
||||||
ContainerBatchSizeDefault = 1000
|
ContainerBatchSizeDefault = 1000
|
||||||
)
|
)
|
||||||
|
|
||||||
|
|
|
@ -36,7 +36,6 @@ func (c *Client) IterateContainersOf(idUser *user.ID, cb func(item cid.ID) error
|
||||||
rawID = idUser.WalletBytes()
|
rawID = idUser.WalletBytes()
|
||||||
}
|
}
|
||||||
|
|
||||||
cnrHash := c.client.ContractAddress()
|
|
||||||
itemCb := func(item stackitem.Item) error {
|
itemCb := func(item stackitem.Item) error {
|
||||||
|
|||||||
id, err := getCIDfromStackItem(item)
|
id, err := getCIDfromStackItem(item)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
|
@ -57,6 +56,7 @@ func (c *Client) IterateContainersOf(idUser *user.ID, cb func(item cid.ID) error
|
||||||
// 512 is big enough value and it is beautiful.
|
// 512 is big enough value and it is beautiful.
|
||||||
const batchSize = 512
|
const batchSize = 512
|
||||||
|
|
||||||
|
cnrHash := c.client.ContractAddress()
|
||||||
err := c.client.Morph().TestInvokeIterator(itemCb, batchSize, cnrHash, containersOfMethod, rawID)
|
err := c.client.Morph().TestInvokeIterator(itemCb, batchSize, cnrHash, containersOfMethod, rawID)
|
||||||
if err != nil && errors.Is(err, unwrap.ErrNoSessionID) {
|
if err != nil && errors.Is(err, unwrap.ErrNoSessionID) {
|
||||||
return c.iterate(idUser, cb)
|
return c.iterate(idUser, cb)
|
||||||
|
|
Loading…
Reference in a new issue
This line was right before the
TestInvokeIterator
previously, why has it moved?Accidentally. Moved it back.