refactor(autorenewal): clean up imports and simplify error handling
This commit is contained in:
@@ -1,4 +1,5 @@
|
||||
import asyncio
|
||||
import contextlib
|
||||
import logging
|
||||
|
||||
from aiogram import Bot, Dispatcher
|
||||
@@ -21,6 +22,7 @@ from services.renewal_service import RenewalService
|
||||
from services.user_service import UserService
|
||||
|
||||
logging.basicConfig(level=logging.DEBUG)
|
||||
contextlib.suppress(asyncio.CancelledError)
|
||||
|
||||
|
||||
async def main():
|
||||
@@ -78,10 +80,7 @@ async def main():
|
||||
await dp.start_polling(bot)
|
||||
finally:
|
||||
scheduler_task.cancel()
|
||||
try:
|
||||
await scheduler_task
|
||||
except asyncio.CancelledError:
|
||||
pass
|
||||
await scheduler_task
|
||||
|
||||
|
||||
if __name__ == "__main__":
|
||||
|
||||
Reference in New Issue
Block a user