mirror of
https://github.com/BerriAI/litellm.git
synced 2026-11-06 07:48:06 +00:00
fix(fallback): replace a stored router_settings row that holds a non-JSON string
This commit is contained in:
parent
fb5bad80ef
commit
9f8fd4ac94
2 changed files with 5 additions and 2 deletions
|
|
@ -60,7 +60,10 @@ async def _reload_config_file_ownership(proxy_config: "ProxyConfig") -> None:
|
|||
|
||||
|
||||
async def _stored_router_settings(prisma_client: PrismaClient) -> Mapping[str, JsonValue]:
|
||||
row: Final = await ConfigRepository(prisma_client, use_writer=True).get_param(ROUTER_SETTINGS_PARAM)
|
||||
try:
|
||||
row: Final = await ConfigRepository(prisma_client, use_writer=True).get_param(ROUTER_SETTINGS_PARAM)
|
||||
except json.JSONDecodeError:
|
||||
return {}
|
||||
if row is None or not isinstance(row.param_value, Mapping):
|
||||
return {}
|
||||
return _STORED_ROUTER_SETTINGS.validate_python(row.param_value)
|
||||
|
|
|
|||
|
|
@ -435,7 +435,7 @@ class TestFallbackWritesSeeTheLatestStoredRules:
|
|||
|
||||
assert stored.stored_fallbacks() == [GATEWAY_RULE]
|
||||
|
||||
@pytest.mark.parametrize("param_value", [None, ["team-primary"], 7])
|
||||
@pytest.mark.parametrize("param_value", [None, ["team-primary"], 7, "not json"])
|
||||
async def test_a_create_replaces_a_stored_row_that_is_not_an_object(self, param_value: JsonValue) -> None:
|
||||
stored: Final = _StoredRouterSettings(None)
|
||||
stored.row = SimpleNamespace(param_name="router_settings", param_value=param_value)
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue