fix indexer

This commit is contained in:
user 2025-03-05 04:16:55 +03:00
parent 198971a391
commit ec484af8c4
1 changed files with 6 additions and 3 deletions

View File

@ -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")