From 03bdb51542ea305e7afc8aeabf524a0ac2453751 Mon Sep 17 00:00:00 2001 From: baishihao Date: Fri, 7 Aug 2026 16:46:30 +0800 Subject: [PATCH] fix(api): update server busy message --- lightllm/utils/error_utils.py | 4 ++-- test/test_api/test_server_busy_handling.py | 3 ++- 2 files changed, 4 insertions(+), 3 deletions(-) diff --git a/lightllm/utils/error_utils.py b/lightllm/utils/error_utils.py index 61212ac2e..9e6a44ee4 100644 --- a/lightllm/utils/error_utils.py +++ b/lightllm/utils/error_utils.py @@ -7,7 +7,7 @@ class ServerBusyError(Exception): """Custom exception for server busy/overload situations""" - def __init__(self, message="Server is busy, please try again later", status_code=429): + def __init__(self, message="Too many requests. Please try again later.", status_code=429): """ Initialize the ServerBusyError @@ -21,7 +21,7 @@ def __init__(self, message="Server is busy, please try again later", status_code def __str__(self): """String representation of the error""" - return f"{self.message} (Status code: {self.status_code})" + return self.message class ClientDisconnected(Exception): diff --git a/test/test_api/test_server_busy_handling.py b/test/test_api/test_server_busy_handling.py index 4650919a0..d66b3d46a 100644 --- a/test/test_api/test_server_busy_handling.py +++ b/test/test_api/test_server_busy_handling.py @@ -33,6 +33,7 @@ def test_server_busy_response_is_rate_limited(monkeypatch): body = json.loads(response.body) assert response.status_code == 429 + assert body["error"]["message"] == "Too many requests. Please try again later." assert body["error"]["type"] == "RateLimitError" assert body["error"]["code"] == 429 assert metric_client.counters == ["lightllm_request_failure"] @@ -158,7 +159,7 @@ async def run(): "type": "error", "error": { "type": "rate_limit_error", - "message": "Server is busy, please try again later (Status code: 429)", + "message": "Too many requests. Please try again later.", }, } assert metric_client.counters == ["lightllm_request_failure"]