Skip to content

Commit

Permalink
Possibility to activate/deactivate the already_left check
Browse files Browse the repository at this point in the history
Default: deactivated

Just in case it turns out too expensive/buggy to some users, let's just
keep the option to activate it for now

Signed-off-by: Raphael Glon <oOraph@users.noreply.github.com>
  • Loading branch information
oOraph committed Aug 31, 2024
1 parent 30c9b0f commit 1fda96f
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.getenv("DISCARD_LEFT", "0").lower() in [
"1",
"true",
"yes",
] and already_left(request):
logger.info("Discarding request as the caller already left")
return Response(status_code=204)

Expand Down

0 comments on commit 1fda96f

Please sign in to comment.