Skip to content

Commit

Permalink
[debug] Temporarily disable request timeout blocking with logging
Browse files Browse the repository at this point in the history
  • Loading branch information
charlieyl committed Feb 12, 2025
1 parent a912c57 commit 2c5539a
Showing 1 changed file with 5 additions and 4 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -79,10 +79,11 @@ async def auth_middleware(request: Request, call_next):

# If timeout threshold is exceeded then cancel and return time out error.
should_block = (mean_latency * pending_requests_num) > request_timeout_s
if should_block:
return JSONResponse(
{"error": True, "message": "Request timed out."},
status_code=status.HTTP_504_GATEWAY_TIMEOUT)
logging.info(f"should_block {should_block}, mean_latency {mean_latency}, pending_requests_num {pending_requests_num}, request_timeout_s {request_timeout_s}")
# if should_block:
# return JSONResponse(
# {"error": True, "message": "Request timed out."},
# status_code=status.HTTP_504_GATEWAY_TIMEOUT)

response = await call_next(request)
return response
Expand Down

0 comments on commit 2c5539a

Please sign in to comment.