File tree Expand file tree Collapse file tree 1 file changed +3
-1
lines changed
packages/service-library/src/servicelib/redis Expand file tree Collapse file tree 1 file changed +3
-1
lines changed Original file line number Diff line number Diff line change @@ -45,7 +45,6 @@ def redis(self) -> aioredis.Redis:
4545 return self ._client
4646
4747 def __post_init__ (self ) -> None :
48- self ._health_check_task_started_event = asyncio .Event ()
4948 self ._client = aioredis .from_url (
5049 self .redis_dsn ,
5150 # Run 3 retries with exponential backoff strategy source: https://redis.readthedocs.io/en/stable/backoff.html
@@ -62,6 +61,7 @@ def __post_init__(self) -> None:
6261 )
6362 # NOTE: connection is done here already
6463 self ._is_healthy = False
64+ self ._health_check_task_started_event = asyncio .Event ()
6565
6666 async def setup (self ) -> None :
6767 @periodic (interval = self .health_check_interval )
@@ -93,6 +93,8 @@ async def shutdown(self) -> None:
9393 ):
9494 if self ._health_check_task :
9595 with log_catch (_logger , reraise = False ):
96+ assert self ._health_check_task_started_event # nosec
97+ await self ._health_check_task_started_event .wait ()
9698 await cancel_wait_task (
9799 self ._health_check_task , max_delay = _HEALTHCHECK_TASK_TIMEOUT_S
98100 )
You can’t perform that action at this time.
0 commit comments