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

This commit is contained in:
Jacob Leksan authored and GitHub committed 2026-05-09 04:46:00 +09:00
1 parent 23ff9943a9
commit b63da90ae4
1 file changed
+7
@@ -88,6 +88,13 @@ class CommitSessionMiddleware:
await self.app(scope, receive, send) await self.app(scope, receive, send)
return 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: try:
await self.app(scope, receive, send) await self.app(scope, receive, send)
except BaseException: except BaseException: