This commit is contained in:
user committed 2024-04-06 09:09:31 +03:00
1 parent b18550918d
commit 2008f73e14
2 files changed
+30 -6

No files matched your search

+8 -6
View File
@@ -41,19 +41,21 @@ async def license_index_loop(memory, platform_found: bool, seqno: int) -> [bool,
except BaseException as e:
make_log("LicenseIndex", f"Error: {e}" + '\n' + traceback.format_exc(), level="error")
for content in session.query(UserContent).filter(
process_content = session.query(UserContent).filter(
and_(
UserContent.type.startswith('nft/'),
UserContent.updated < (datetime.now() - timedelta(minutes=15)),
UserContent.updated < (datetime.now() - timedelta(minutes=5)),
)
):
).first()
if process_content:
make_log("LicenseIndex", f"Syncing content with blockchain: {content.id}", level="info")
try:
await content.sync_with_chain(session)
content.updated = datetime.now()
session.commit()
await process_content.sync_with_chain(session)
except BaseException as e:
make_log("LicenseIndex", f"Error: {e}" + '\n' + traceback.format_exc(), level="error")
finally:
process_content.updated = datetime.now()
session.commit()
for action in session.query(UserAction).filter(
and_(