fix refresh token

This commit is contained in:
2025-12-28 11:55:30 +05:00
parent 2322b27ace
commit 5db5b98dbc
2 changed files with 68 additions and 15 deletions

View File

@ -11,6 +11,7 @@ from app.services.promo import PromoService
from app.webhooks import telegram
from app.db.database import users_collection
from app.api import marketplace_ws
from app.db.database import users_collection, sessions_collection
###################### БОТ ######################
@ -23,6 +24,12 @@ WEBHOOK_SECRET = os.getenv("TELEGRAM_WEBHOOK_SECRET", "")
async def lifespan(app: FastAPI):
# ===== STARTUP =====
# TTL для сессий (автоочистка)
await sessions_collection.create_index(
"expires_at",
expireAfterSeconds=0
)
await users_collection.create_index("expires_at", expireAfterSeconds=0)
await users_collection.create_index("telegram_user_id", unique=True, sparse=True)