From e7a05a49ff453b51f941211eb79b37268aacd19f Mon Sep 17 00:00:00 2001 From: Airat Arifullin Date: Tue, 9 Apr 2024 14:15:39 +0300 Subject: [PATCH] [#XX] client: Terminate session in `ReadIteratorItems` * Make an invoker terminate session by its ID before return, otherwise, it may lead to `max session capacity reached error`. Signed-off-by: Airat Arifullin --- commonclient/iterator.go | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/commonclient/iterator.go b/commonclient/iterator.go index 0bdd68c..a46eab8 100644 --- a/commonclient/iterator.go +++ b/commonclient/iterator.go @@ -29,6 +29,10 @@ func ReadIteratorItems(inv Invoker, batchSize int, contract util.Uint160, method return arr, nil } + defer func() { + _ = inv.TerminateSession(sessionID) + }() + var shouldStop bool res := arr for !shouldStop {