Unverified Commit 6e4cea1c authored by daniel-salib's avatar daniel-salib Committed by GitHub
Browse files

decrement server_load on listen for disconnect (#18784)


Signed-off-by: default avatarDaniel Salib <danielsalib@meta.com>
parent 435fa954
...@@ -26,6 +26,11 @@ async def listen_for_disconnect(request: Request) -> None: ...@@ -26,6 +26,11 @@ async def listen_for_disconnect(request: Request) -> None:
while True: while True:
message = await request.receive() message = await request.receive()
if message["type"] == "http.disconnect": if message["type"] == "http.disconnect":
if request.app.state.enable_server_load_tracking:
# on timeout/cancellation the BackgroundTask in load_aware_call
# cannot decrement the server load metrics.
# Must be decremented by with_cancellation instead.
request.app.state.server_load_metrics -= 1
break break
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment