dev@locazia: add try-except
This commit is contained in:
parent
8fdd67dda1
commit
b6a9b5c0ab
|
|
@ -55,7 +55,7 @@ async def main():
|
|||
|
||||
while True:
|
||||
sw_seqno_value = await get_sw_seqno()
|
||||
make_log("TON", "Service running (seqno}", level="debug")
|
||||
make_log("TON", f"Service running (seqno}", level="debug")
|
||||
# with db_session() as session:
|
||||
# for stored_content in session.query(StoredContent).filter(StoredContent.uploaded == False).all():
|
||||
# pass
|
||||
|
|
|
|||
|
|
@ -2,21 +2,31 @@ from app.core._utils.send_status import send_status
|
|||
|
||||
from app.core.logger import make_log
|
||||
from app.core.storage import db_session
|
||||
import traceback
|
||||
import asyncio
|
||||
|
||||
|
||||
async def uploader_loop():
|
||||
pass
|
||||
|
||||
|
||||
async def main():
|
||||
make_log("Uploader", "Service started", level="info")
|
||||
seqno = 0
|
||||
while True:
|
||||
# make_log("Uploader", "Service running", level="debug")
|
||||
# with db_session() as session:
|
||||
# for stored_content in session.query(StoredContent).filter(StoredContent.uploaded == False).all():
|
||||
# pass
|
||||
try:
|
||||
make_log("Uploader", "Service running", level="debug")
|
||||
await uploader_loop()
|
||||
# with db_session() as session:
|
||||
# for stored_content in session.query(StoredContent).filter(StoredContent.uploaded == False).all():
|
||||
# pass
|
||||
|
||||
await asyncio.sleep(5)
|
||||
await send_status("uploader", f"working (seqno={seqno})")
|
||||
seqno += 1
|
||||
await asyncio.sleep(5)
|
||||
await send_status("uploader", f"working (seqno={seqno})")
|
||||
seqno += 1
|
||||
except BaseException as e:
|
||||
make_log("Uploader", f"Error: {e}" + '\n' + str(traceback.format_exc()), level="error")
|
||||
await asyncio.sleep(3)
|
||||
|
||||
if __name__ == '__main__':
|
||||
loop = asyncio.get_event_loop()
|
||||
|
|
|
|||
Loading…
Reference in New Issue