Skip to content

Commit

Permalink
fix: correct the logic of bypassing infra endpoints in traffic middle…
Browse files Browse the repository at this point in the history
…ware (#4704)

Signed-off-by: Frost Ming <me@frostming.com>
  • Loading branch information
frostming committed May 6, 2024
1 parent c1e2a94 commit 7789ee6
Showing 1 changed file with 4 additions and 1 deletion.
5 changes: 4 additions & 1 deletion src/bentoml/_internal/server/http/traffic.py
Expand Up @@ -42,7 +42,10 @@ async def __call__(
if scope["type"] not in ("http", "websocket"):
return await self.app(scope, receive, send)

if self._semaphore.locked() and scope["path"] not in self.BYPASS_PATHS:
if scope["path"] in self.BYPASS_PATHS:
return await self.app(scope, receive, send)

if self._semaphore.locked():
resp = JSONResponse({"error": "Too many requests"}, status_code=429)
await resp(scope, receive, send)
return
Expand Down

0 comments on commit 7789ee6

Please sign in to comment.