19 lines
633 B
Python
19 lines
633 B
Python
from contextlib import suppress
|
|
|
|
from app.automation.scheduler import AutomationScheduler
|
|
from app.telegram.bot import TelegramBotService
|
|
|
|
|
|
class RuntimeServices:
|
|
def __init__(self) -> None:
|
|
self.telegram_bot: TelegramBotService | None = None
|
|
self.automation_scheduler: AutomationScheduler | None = None
|
|
|
|
async def shutdown(self) -> None:
|
|
if self.automation_scheduler is not None:
|
|
with suppress(Exception):
|
|
await self.automation_scheduler.stop()
|
|
if self.telegram_bot is not None:
|
|
with suppress(Exception):
|
|
await self.telegram_bot.stop()
|