Skip to content

Commit

Permalink
Possibility to deactivate the already_left check
Browse files Browse the repository at this point in the history
Just in case it turns out too expensive/buggy to some users, let's just
keep the option to dactivate it

Signed-off-by: Raphael Glon <[email protected]>
  • Loading branch information
oOraph committed Aug 27, 2024
1 parent d86e270 commit eb29f1b
Showing 1 changed file with 5 additions and 1 deletion.
6 changes: 5 additions & 1 deletion api_inference_community/routes.py
Original file line number Diff line number Diff line change
Expand Up @@ -88,7 +88,11 @@ def already_left(request: Request) -> bool:
async def pipeline_route(request: Request) -> Response:
start = time.time()

if already_left(request):
if os.environ.get("DISCARD_LEFT", "1").lower() in [
"true",
"yes",
"1",
] and already_left(request):
logger.info("Discarding request as the caller already left")
return Response(status_code=204)

Expand Down

0 comments on commit eb29f1b

Please sign in to comment.