From 61463a43b1ec8f973e7a6ef201d037cee3ff19de Mon Sep 17 00:00:00 2001 From: AlexsanderHamir Date: Tue, 16 Sep 2025 15:49:35 -0700 Subject: [PATCH] fix: exception hanging & cache setting 1. Removed unhandled exceptions 2. Set cache value to dict --- litellm/proxy/common_utils/performance_utils.py | 6 +++--- tests/proxy_unit_tests/test_auth_checks.py | 2 +- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/litellm/proxy/common_utils/performance_utils.py b/litellm/proxy/common_utils/performance_utils.py index 1aa51dd5b00..fe238f2e331 100644 --- a/litellm/proxy/common_utils/performance_utils.py +++ b/litellm/proxy/common_utils/performance_utils.py @@ -72,7 +72,7 @@ def _save_stats(profile_file: PathLib) -> None: # Make sure profiler is re-enabled even if there's an error try: _profiler.enable() - except: + except Exception: pass @@ -101,7 +101,7 @@ def profile_endpoint(sampling_rate: float = 1.0): if is_sampling: _save_stats(file_path_obj) return result - except Exception as e: + except Exception: if is_sampling: _save_stats(file_path_obj) raise @@ -117,7 +117,7 @@ def profile_endpoint(sampling_rate: float = 1.0): if is_sampling: _save_stats(file_path_obj) return result - except Exception as e: + except Exception: if is_sampling: _save_stats(file_path_obj) raise diff --git a/tests/proxy_unit_tests/test_auth_checks.py b/tests/proxy_unit_tests/test_auth_checks.py index 2c829406c01..24c005443af 100644 --- a/tests/proxy_unit_tests/test_auth_checks.py +++ b/tests/proxy_unit_tests/test_auth_checks.py @@ -48,7 +48,7 @@ async def test_get_end_user_object(customer_spend, customer_budget): ) _cache = DualCache() _key = "end_user_id:{}".format(end_user_id) - _cache.set_cache(key=_key, value=end_user_obj) + _cache.set_cache(key=_key, value=end_user_obj.model_dump()) try: await get_end_user_object( end_user_id=end_user_id,