Добавлена ветка cosmetics

This commit is contained in:
grigorij
2026-07-31 13:07:25 +04:00
parent f289631645
commit d757352b8a
19 changed files with 108 additions and 337 deletions
+1 -11
View File
@@ -4,7 +4,6 @@ import signal
import sys
from aiogram import Bot, Dispatcher
from aiogram.fsm.storage.redis import RedisStorage, DefaultKeyBuilder
from app.config import BOT_TOKEN, USE_POSTGRES
from app.logger import logger
@@ -20,13 +19,7 @@ from app.handlers.contacts import router as contacts_router
from app.handlers.admin import router as admin_router
bot = Bot(token=BOT_TOKEN)
# Redis FSM storage — survives bot restarts, persistent across polling sessions
redis_storage = RedisStorage.from_url(
"redis://localhost:6379/0",
key_builder=DefaultKeyBuilder(with_destiny=True)
)
dp = Dispatcher(storage=redis_storage)
dp = Dispatcher()
# Register routers
dp.include_routers(
@@ -83,9 +76,6 @@ async def on_shutdown():
if _health_runner:
await _health_runner.cleanup()
logger.info("Healthcheck server stopped")
if redis_storage:
await redis_storage.close()
logger.info("Redis storage closed")
pending = asyncio.all_tasks()
if pending:
logger.debug("Cancelling {count} pending tasks", count=len(pending))