Добавлена ветка cosmetics
This commit is contained in:
+1
-11
@@ -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))
|
||||
|
||||
Reference in New Issue
Block a user