dev@locazia: fix indexer

This commit is contained in:
user 2024-03-10 14:29:46 +03:00
parent dae4a6f123
commit c4be5a8099
2 changed files with 2 additions and 2 deletions

View File

@ -20,7 +20,7 @@ def get_git_info():
async def s_api_v1_node(request): # /api/v1/node async def s_api_v1_node(request): # /api/v1/node
last_known_index = request.ctx.db_session.query(StoredContent).filter( last_known_index = request.ctx.db_session.query(StoredContent).filter(
StoredContent.type == "onchain/content" StoredContent.onchain_index != None
).order_by(StoredContent.onchain_index.desc()).first() ).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) last_known_index = max(last_known_index, 0)

View File

@ -42,7 +42,7 @@ async def indexer_loop(memory, platform_found: bool, seqno: int) -> [bool, int]:
session.commit() session.commit()
last_known_index = session.query(StoredContent).filter( last_known_index = session.query(StoredContent).filter(
StoredContent.type == "onchain/content" StoredContent.onchain_index != None
).order_by(StoredContent.onchain_index.desc()).first() ).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) last_known_index = max(last_known_index, 0)