Enhance CommitSessionMiddleware to allow health probes to bypass session management, ensuring faster and more reliable responses. (#24384)

This commit is contained in:
Jacob Leksan
2026-05-08 15:46:00 -04:00
committed by GitHub
parent 23ff9943a9
commit b63da90ae4

View File

@@ -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: