uploader-bot/app/core/background/license_service.py

51 lines
1.6 KiB
Python

import asyncio
from base64 import b64decode
from datetime import datetime
from base58 import b58encode
from tonsdk.boc import Cell
from tonsdk.utils import Address
from app.core._blockchain.ton.platform import platform
from app.core._blockchain.ton.toncenter import toncenter
from app.core._utils.send_status import send_status
from app.core.logger import make_log
from app.core.models.node_storage import StoredContent
from app.core._utils.resolve_content import resolve_content
from app.core.models.wallet_connection import WalletConnection
from app.core._keyboards import get_inline_keyboard
from app.core.models._telegram import Wrapped_CBotChat
from app.core.storage import db_session
import os
import traceback
async def license_index_loop(memory, platform_found: bool, seqno: int) -> [bool, int]:
make_log("LicenseIndex", "Service running", level="debug")
with db_session() as session:
pass
return platform_found, seqno
async def main_fn(memory, ):
make_log("LicenseIndex", "Service started", level="info")
platform_found = False
seqno = 0
while True:
try:
platform_found, seqno = await license_index_loop(memory, platform_found, seqno)
except BaseException as e:
make_log("LicenseIndex", f"Error: {e}" + '\n' + traceback.format_exc(), level="error")
if platform_found:
await send_status("LicenseIndex", f"working (seqno={seqno})")
await asyncio.sleep(5)
seqno += 1
# if __name__ == '__main__':
# loop = asyncio.get_event_loop()
# loop.run_until_complete(main())
# loop.close()