fix(proxy): apply db-backed max_batch_file_size_mb on config reload

This commit is contained in:
mateo-berri 2026-08-19 15:37:44 -07:00
parent 0f4c2d71fb
commit 9bb5483991
2 changed files with 40 additions and 0 deletions

View file

@ -6316,6 +6316,9 @@ class ProxyConfig:
if "global_max_parallel_requests" in _general_settings:
general_settings["global_max_parallel_requests"] = _general_settings["global_max_parallel_requests"]
if "max_batch_file_size_mb" not in self._yaml_general_settings_keys:
general_settings["max_batch_file_size_mb"] = _general_settings.get("max_batch_file_size_mb")
## ALERTING ARGS ##
if "alerting_args" in _general_settings:
general_settings["alerting_args"] = _general_settings["alerting_args"]

View file

@ -2442,6 +2442,43 @@ async def test_ProxyConfig__update_general_settings_updates_max_parallel(monkeyp
}
@pytest.mark.asyncio
async def test_ProxyConfig__update_general_settings_applies_db_max_batch_file_size_mb(monkeypatch):
monkeypatch.setattr("litellm.proxy.proxy_server.general_settings", {})
pc = ProxyConfig()
await pc._update_general_settings({"max_batch_file_size_mb": 5})
from litellm.proxy import proxy_server as ps
assert ps.general_settings.get("max_batch_file_size_mb") == 5
@pytest.mark.asyncio
async def test_ProxyConfig__update_general_settings_yaml_max_batch_file_size_mb_wins_over_db(monkeypatch):
monkeypatch.setattr(
"litellm.proxy.proxy_server.general_settings",
{"max_batch_file_size_mb": 3},
)
pc = ProxyConfig()
pc._yaml_general_settings_keys = {"max_batch_file_size_mb"}
await pc._update_general_settings({"max_batch_file_size_mb": 5})
from litellm.proxy import proxy_server as ps
assert ps.general_settings.get("max_batch_file_size_mb") == 3
@pytest.mark.asyncio
async def test_ProxyConfig__update_general_settings_cleared_db_max_batch_file_size_mb_lifts_cap(monkeypatch):
monkeypatch.setattr(
"litellm.proxy.proxy_server.general_settings",
{"max_batch_file_size_mb": 8},
)
pc = ProxyConfig()
await pc._update_general_settings({"max_parallel_requests": 1})
from litellm.proxy import proxy_server as ps
assert ps.general_settings.get("max_batch_file_size_mb") is None
@pytest.mark.asyncio
async def test_ProxyConfig__update_general_settings_none_input_noop():
pc = ProxyConfig()