Handle errors on log ring worker

This commit is contained in:
blank X 2021-03-29 15:15:41 +07:00
parent 16a4b6850b
commit e4ad50241b
Signed by: blankie
GPG Key ID: CC15FC822C7F61F5
1 changed files with 6 additions and 0 deletions

View File

@ -1,4 +1,7 @@
import html
import asyncio
import logging
import traceback
from pyrogram import idle
from pyrogram.errors.exceptions.flood_420 import FloodWait
from . import loop, apps, slave, app_user_ids, session, log_ring, config
@ -28,6 +31,9 @@ async def main():
await slave.send_message(config['config']['log_chat'], text, disable_web_page_preview=True)
except FloodWait as ex:
await asyncio.sleep(ex.x + 1)
except BaseException:
logging.exception('Exception occured while sending message to log chat')
log_ring.append(f'Exception occured while sending message to log chat\n\n{html.escape(traceback.format_exc())}')
else:
break
asyncio.create_task(log_ring_worker())