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]

tes numeric constants

Ishaan Jaffer8a7f39daa462
diff --git a/litellm/constants.py b/litellm/constants.py
index 5f98567819e..37bf68d5cde 100644
--- a/litellm/constants.py
+++ b/litellm/constants.py
@@ -1056,10 +1056,10 @@ PROXY_BATCH_WRITE_AT = int(os.getenv("PROXY_BATCH_WRITE_AT", 30)) # in seconds,
# APScheduler Configuration - MEMORY LEAK FIX
# These settings prevent memory leaks in APScheduler's normalize() and _apply_jitter() functions
-APSCHEDULER_COALESCE = True # collapse many missed runs into one
-APSCHEDULER_MISFIRE_GRACE_TIME = 3600 # ignore runs older than 1 hour (was 120)
-APSCHEDULER_MAX_INSTANCES = 1 # prevent concurrent job instances
-APSCHEDULER_REPLACE_EXISTING = True # always replace existing jobs
+APSCHEDULER_COALESCE = os.getenv("APSCHEDULER_COALESCE", "True").lower() in ["true", "1"] # collapse many missed runs into one
+APSCHEDULER_MISFIRE_GRACE_TIME = int(os.getenv("APSCHEDULER_MISFIRE_GRACE_TIME", 3600)) # ignore runs older than 1 hour (was 120)
+APSCHEDULER_MAX_INSTANCES = int(os.getenv("APSCHEDULER_MAX_INSTANCES", 1)) # prevent concurrent job instances
+APSCHEDULER_REPLACE_EXISTING = os.getenv("APSCHEDULER_REPLACE_EXISTING", "True").lower() in ["true", "1"] # always replace existing jobs
DEFAULT_HEALTH_CHECK_INTERVAL = int(
os.getenv("DEFAULT_HEALTH_CHECK_INTERVAL", 300)
diff --git a/tests/test_litellm/test_constants.py b/tests/test_litellm/test_constants.py
index 8fea7342305..77f2f308f88 100644
--- a/tests/test_litellm/test_constants.py
+++ b/tests/test_litellm/test_constants.py
@@ -26,10 +26,11 @@ def test_all_numeric_constants_can_be_overridden():
constants_attributes = inspect.getmembers(constants)
# Filter for uppercase constants (by convention) that are integers or floats
+ # Exclude booleans since bool is a subclass of int in Python
numeric_constants = [
(name, value)
for name, value in constants_attributes
- if name.isupper() and isinstance(value, (int, float))
+ if name.isupper() and isinstance(value, (int, float)) and not isinstance(value, bool)
]
# Ensure we found some constants to test