diff --git a/litellm/proxy/common_utils/config_sync_pubsub.py b/litellm/proxy/common_utils/config_sync_pubsub.py index e3de9809f02..3e6c3f8028a 100644 --- a/litellm/proxy/common_utils/config_sync_pubsub.py +++ b/litellm/proxy/common_utils/config_sync_pubsub.py @@ -236,7 +236,7 @@ class ConfigSyncSubscriber: await pubsub.subscribe(config_sync_channel(self._redis_cache)) backoff_seconds = self._backoff_initial_seconds if self._resync_on_subscribe: - await self._resync() + await self._resync(pubsub) self._resync_on_subscribe = False await self._consume(pubsub) finally: diff --git a/tests/unit/proxy/common_utils/test_config_sync_pubsub.py b/tests/unit/proxy/common_utils/test_config_sync_pubsub.py index 28c5ac9aed1..7c31c1aeb9f 100644 --- a/tests/unit/proxy/common_utils/test_config_sync_pubsub.py +++ b/tests/unit/proxy/common_utils/test_config_sync_pubsub.py @@ -1,6 +1,7 @@ import asyncio import json import random +import typing from typing import Callable, Coroutine, Iterable, List, Optional, Tuple from unittest.mock import AsyncMock, MagicMock, patch @@ -434,13 +435,13 @@ async def test_writes_during_the_throttle_wait_collapse_into_the_next_resync() - async def test_write_arriving_during_throttle_wait_does_not_trigger_an_extra_resync() -> None: - pubsub = _QueuePubSub() - cache = _FakeRedisCache(_ScriptedPubSubRedisClient([pubsub])) - clock = _FakeClock() - first_resync = asyncio.Event() - second_resync = asyncio.Event() - inserted_during_wait = asyncio.Event() - resyncs: List[str] = [] + pubsub: typing.Final = _QueuePubSub() + cache: typing.Final = _FakeRedisCache(_ScriptedPubSubRedisClient([pubsub])) + clock: typing.Final = _FakeClock() + first_resync: typing.Final = asyncio.Event() + second_resync: typing.Final = asyncio.Event() + inserted_during_wait: typing.Final = asyncio.Event() + resyncs: typing.Final[List[str]] = [] async def recording_sleep(seconds: float) -> None: if seconds > 0 and not inserted_during_wait.is_set(): @@ -455,7 +456,7 @@ async def test_write_arriving_during_throttle_wait_does_not_trigger_an_extra_res if len(resyncs) == 2: second_resync.set() - subscriber = ConfigSyncSubscriber( + subscriber: typing.Final = ConfigSyncSubscriber( redis_cache=cache, resync_callbacks=(resync,), debounce_seconds=0.0,