From cd6b121642b2e998905afb567f4cc1d4cbe9020e Mon Sep 17 00:00:00 2001 From: Ishaan Jaff Date: Tue, 2 Jul 2024 11:29:24 -0700 Subject: [PATCH] use deep copy of router for _run_background_health_check --- litellm/proxy/proxy_server.py | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/litellm/proxy/proxy_server.py b/litellm/proxy/proxy_server.py index 0577ec0a04..691726afda 100644 --- a/litellm/proxy/proxy_server.py +++ b/litellm/proxy/proxy_server.py @@ -1182,9 +1182,13 @@ async def _run_background_health_check(): Update health_check_results, based on this. """ global health_check_results, llm_model_list, health_check_interval + + # make 1 deep copy of llm_model_list -> use this for all background health checks + _llm_model_list = copy.deepcopy(llm_model_list) + while True: healthy_endpoints, unhealthy_endpoints = await perform_health_check( - model_list=llm_model_list + model_list=_llm_model_list ) # Update the global variable with the health check results