diff --git a/app/middlewares/context_binding.py b/app/middlewares/context_binding.py index 25181991..e727fcb6 100644 --- a/app/middlewares/context_binding.py +++ b/app/middlewares/context_binding.py @@ -23,5 +23,5 @@ class ContextVarsMiddleware(BaseMiddleware): ctx['username'] = event.from_user.username or '' if hasattr(event, 'chat') and event.chat: ctx['chat_id'] = event.chat.id - async with bound_contextvars(**ctx): + with bound_contextvars(**ctx): return await handler(event, data) diff --git a/app/webapi/middleware.py b/app/webapi/middleware.py index c12606c5..1ed2d26e 100644 --- a/app/webapi/middleware.py +++ b/app/webapi/middleware.py @@ -17,7 +17,7 @@ class RequestLoggingMiddleware(BaseHTTPMiddleware): """Логирование входящих запросов в административный API.""" async def dispatch(self, request: Request, call_next: RequestResponseEndpoint) -> Response: - async with bound_contextvars(http_method=request.method, http_path=request.url.path): + with bound_contextvars(http_method=request.method, http_path=request.url.path): start = monotonic() response: Response | None = None try: