Skip to content

Commit a03d9f6

Browse files
shevronShahar Evron
andauthored
Reduce the log level of 'request limit exceeded' messages (#2788)
Co-authored-by: Shahar Evron <shahar@DS-shahar-MBP.local>
1 parent e377de4 commit a03d9f6

2 files changed

Lines changed: 2 additions & 2 deletions

File tree

tests/test_server.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -90,7 +90,7 @@ async def interrupt_running(srv: Server):
9090
async def test_request_than_limit_max_requests_warn_log(
9191
unused_tcp_port: int, http_protocol_cls: type[H11Protocol | HttpToolsProtocol], caplog: pytest.LogCaptureFixture
9292
):
93-
caplog.set_level(logging.WARNING, logger="uvicorn.error")
93+
caplog.set_level(logging.INFO, logger="uvicorn.error")
9494
config = Config(app=app, limit_max_requests=1, port=unused_tcp_port, http=http_protocol_cls)
9595
async with run_server(config):
9696
async with httpx.AsyncClient() as client:

uvicorn/server.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -255,7 +255,7 @@ async def on_tick(self, counter: int) -> bool:
255255

256256
max_requests = self.config.limit_max_requests
257257
if max_requests is not None and self.server_state.total_requests >= max_requests:
258-
logger.warning(f"Maximum request limit of {max_requests} exceeded. Terminating process.")
258+
logger.info("Maximum request limit of %d exceeded. Terminating process.", max_requests)
259259
return True
260260

261261
return False

0 commit comments

Comments
 (0)