Enhance CommitSessionMiddleware to allow health probes to bypass session management, ensuring faster and more reliable responses. (#24384)
This commit is contained in:
@@ -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:
|
||||||
|
|||||||
Reference in New Issue
Block a user