mirror of
https://github.com/GNS3/gns3-server.git
synced 2026-11-03 05:51:15 +02:00
Add timing logs to auth dependency chain to identify 6s pre-handler delay
This commit is contained in:
2 files changed
+13
No files matched your search
@@ -21,11 +21,19 @@ from sqlalchemy.ext.asyncio import AsyncSession
|
||||
|
||||
from gns3server.db.repositories.base import BaseRepository
|
||||
|
||||
import logging
|
||||
|
||||
log = logging.getLogger(__name__)
|
||||
|
||||
|
||||
async def get_db_session(request: HTTPConnection) -> AsyncSession:
|
||||
|
||||
import time
|
||||
_t0 = time.time()
|
||||
log.info(f"[CTRL-TIMING] get_db_session ENTER")
|
||||
async with AsyncSession(request.app.state._db_engine, expire_on_commit=False) as session:
|
||||
try:
|
||||
log.info(f"[CTRL-TIMING] get_db_session SESSION_READY elapsed={time.time()-_t0:.3f}s")
|
||||
yield session
|
||||
finally:
|
||||
await session.close()
|
||||
|
||||
Reference in new issue
Block a user