From 343360d7af03fcb649a430ea272ae0ec4b3f4733 Mon Sep 17 00:00:00 2001 From: Charan Rathore Date: Mon, 28 Sep 2026 10:31:17 +0530 Subject: [PATCH] fix: type registered health lock script --- .../health_check_utils/shared_health_check_manager.py | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) diff --git a/litellm/proxy/health_check_utils/shared_health_check_manager.py b/litellm/proxy/health_check_utils/shared_health_check_manager.py index c775032c54c..16b5a479b40 100644 --- a/litellm/proxy/health_check_utils/shared_health_check_manager.py +++ b/litellm/proxy/health_check_utils/shared_health_check_manager.py @@ -1,8 +1,8 @@ import asyncio import json import time -from collections.abc import Mapping, Sequence -from typing import TYPE_CHECKING, Any, Final +from collections.abc import Awaitable, Callable, Mapping, Sequence +from typing import TYPE_CHECKING, Any, Final, cast from litellm._logging import verbose_proxy_logger from litellm.caching.redis_cache import RedisCache @@ -38,7 +38,7 @@ class SharedHealthCheckManager: self.health_check_ttl = health_check_ttl self.lock_ttl = lock_ttl self.pod_id = f"pod_{int(time.time() * 1000)}" - self._release_lock_script: Any | None = None + self._release_lock_script: Callable[..., Awaitable[int]] | None = None @staticmethod def get_health_check_lock_key() -> str: @@ -111,7 +111,9 @@ end try: if self._release_lock_script is None: - self._release_lock_script = script_register(self._COMPARE_AND_DELETE_LOCK_SCRIPT) + self._release_lock_script = cast( + Callable[..., Awaitable[int]], script_register(self._COMPARE_AND_DELETE_LOCK_SCRIPT) + ) result: Final = await self._release_lock_script(keys=[lock_key], args=[json.dumps(self.pod_id)]) if int(result or 0) == 1: verbose_proxy_logger.info("Pod %s released health check lock", self.pod_id)