Skip to content

The fastest, litest AI Gateway. Rust core with Python SDK. Call 100+ LLM APIs in OpenAI (or native) format with cost tracking, guardrails, load balancing, and logging [Bedrock, Azure, OpenAI, Anthropic, OpenAI, VertexAI, vLLM, Nvidia NIM]

fix: accurate wipe count on partial failure, remove stray blank line

Ryan Crabbe0020e5929d17
diff --git a/litellm/proxy/prometheus_cleanup.py b/litellm/proxy/prometheus_cleanup.py
index 6907752e80e..6d935a8dd90 100644
--- a/litellm/proxy/prometheus_cleanup.py
+++ b/litellm/proxy/prometheus_cleanup.py
@@ -15,14 +15,16 @@ from litellm._logging import verbose_proxy_logger
def wipe_directory(directory: str) -> None:
"""Delete all .db files in the directory. Called once before workers fork."""
files = glob.glob(os.path.join(directory, "*.db"))
+ deleted = 0
for filepath in files:
try:
os.remove(filepath)
+ deleted += 1
except OSError as e:
verbose_proxy_logger.warning(
f"Failed to delete stale prometheus file {filepath}: {e}"
)
- if files:
+ if deleted:
verbose_proxy_logger.info(
- f"Prometheus cleanup: wiped {len(files)} stale .db files from {directory}"
+ f"Prometheus cleanup: wiped {deleted} stale .db files from {directory}"
)
diff --git a/litellm/proxy/proxy_server.py b/litellm/proxy/proxy_server.py
index 6def6606325..f0b1e66818c 100644
--- a/litellm/proxy/proxy_server.py
+++ b/litellm/proxy/proxy_server.py
@@ -2045,7 +2045,6 @@ def _schedule_background_health_check_db_save(
)
-
async def _run_background_health_check():
"""
Periodically run health checks in the background on the endpoints.