From b63da90ae4cba35ef69feb57179e7938f6c09fce Mon Sep 17 00:00:00 2001 From: Jacob Leksan <63938553+jmleksan@users.noreply.github.com> Date: Fri, 8 May 2026 15:46:00 -0400 Subject: [PATCH] Enhance CommitSessionMiddleware to allow health probes to bypass session management, ensuring faster and more reliable responses. (#24384) --- backend/open_webui/utils/asgi_middleware.py | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/backend/open_webui/utils/asgi_middleware.py b/backend/open_webui/utils/asgi_middleware.py index e3872dd231..3b478d8b4a 100644 --- a/backend/open_webui/utils/asgi_middleware.py +++ b/backend/open_webui/utils/asgi_middleware.py @@ -88,6 +88,13 @@ class CommitSessionMiddleware: await self.app(scope, receive, send) return + path = scope.get('path', '') + # Keep health probes independent from sync session commit/remove + # so DB pressure cannot delay or fail probe responses. + if path in {'/health', '/ready', '/health/db'}: + await self.app(scope, receive, send) + return + try: await self.app(scope, receive, send) except BaseException: