From ec484af8c4e42ee5383fd8df292f273f4389c575 Mon Sep 17 00:00:00 2001 From: user Date: Wed, 5 Mar 2025 04:16:55 +0300 Subject: [PATCH] fix indexer --- app/core/background/indexer_service.py | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/app/core/background/indexer_service.py b/app/core/background/indexer_service.py index 01c28ef..36e3724 100644 --- a/app/core/background/indexer_service.py +++ b/app/core/background/indexer_service.py @@ -101,13 +101,16 @@ async def indexer_loop(memory, platform_found: bool, seqno: int) -> [bool, int]: session.commit() - last_known_index = session.query(StoredContent).filter( + last_known_index_ = session.query(StoredContent).filter( StoredContent.onchain_index != None ).order_by(StoredContent.onchain_index.desc()).first() - last_known_index = last_known_index.onchain_index if last_known_index else 0 + last_known_index = last_known_index_.onchain_index if last_known_index_ else 0 last_known_index = max(last_known_index, 0) make_log("Indexer", f"Last known index: {last_known_index}", level="debug") - next_item_index = last_known_index + 1 + if last_known_index_: + next_item_index = last_known_index + 1 + else: + next_item_index = 0 resolve_item_result = await toncenter.run_get_method(platform.address.to_string(1, 1, 1), 'get_nft_address_by_index', [['num', next_item_index]]) make_log("Indexer", f"Resolve item result: {resolve_item_result}", level="debug")