refactor(autorenewal): clean up imports and simplify error handling

This commit is contained in:
2026-05-18 17:58:34 +07:00
parent a9a650f37b
commit 1228ec8b56
9 changed files with 19 additions and 34 deletions

View File

@@ -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__":