Refactor startup and shutdown handlers in bot initialization for compatibility with aiogram event signature

- Wrapped the startup and shutdown handlers to ensure they conform to the aiogram event signature, allowing for proper argument handling.
- Updated the web server to access dispatcher workflow data directly, preventing sequence protocol issues and enhancing stability.
This commit is contained in:
machka-pasla
2025-08-17 12:13:08 +03:00
parent 87664a7735
commit ef9ebc1918
2 changed files with 10 additions and 4 deletions
+7 -2
View File
@@ -260,8 +260,13 @@ async def run_bot(settings_param: Settings):
dp["panel_service"] = services["panel_service"]
dp["async_session_factory"] = local_async_session_factory
dp.startup.register(on_startup_configured)
dp.shutdown.register(on_shutdown_configured)
# Wrap startup/shutdown handlers to satisfy aiogram event signature (no args passed)
async def _on_startup_wrapper():
await on_startup_configured(dp)
async def _on_shutdown_wrapper():
await on_shutdown_configured(dp)
dp.startup.register(_on_startup_wrapper)
dp.shutdown.register(_on_shutdown_wrapper)
await register_all_routers(dp, settings_param)