fix: precompute dummy password hash at startup
- lifespan computes the dummy Argon2id hash: first unknown-user login takes as long as a wrong password - evidence for session TTL from config.toml, default and environment - REPORT.md: manual /docs check, TTL configuration row - tasks.md: why checks ran on a separate dev database Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
@@ -10,6 +10,7 @@ from src.api.routers import health_router, v1_router
|
||||
from src.config import settings
|
||||
from src.infra.db.session import engine
|
||||
from src.infra.logger import AbstractLogger, get_logger
|
||||
from src.infra.password import prepare_dummy_hash
|
||||
from src.schemas.enums import RunModeEnum
|
||||
|
||||
logger: AbstractLogger = get_logger().bind(module="startup")
|
||||
@@ -22,6 +23,9 @@ async def lifespan(_: FastAPI) -> AsyncIterator[None]:
|
||||
# /health/ready отвечает 503
|
||||
if not database.password.get_secret_value():
|
||||
logger.warning("Database password is empty")
|
||||
# ~30 мс CPU при старте: время ответа на вход с неизвестным username
|
||||
# ровное с первого запроса
|
||||
await prepare_dummy_hash()
|
||||
logger.info(
|
||||
"Started API",
|
||||
host=settings.app.host,
|
||||
|
||||
Reference in New Issue
Block a user