File tree Expand file tree Collapse file tree 1 file changed +5
-4
lines changed
packages/service-library/src/servicelib/redis Expand file tree Collapse file tree 1 file changed +5
-4
lines changed Original file line number Diff line number Diff line change @@ -71,13 +71,16 @@ def __post_init__(self) -> None:
7171 )
7272 self ._is_healthy = False
7373 self ._started_event_task_health_check = asyncio .Event ()
74+ self ._cancelled_event_task_health_check = asyncio .Event ()
7475
7576 async def setup (self ) -> None :
7677 @periodic (interval = self .health_check_interval )
7778 async def _periodic_check_health () -> None :
7879 assert self ._started_event_task_health_check # nosec
7980 self ._started_event_task_health_check .set ()
8081 self ._is_healthy = await self .ping ()
82+ if self ._cancelled_event_task_health_check .is_set ():
83+ raise asyncio .CancelledError
8184
8285 self ._task_health_check = asyncio .create_task (
8386 _periodic_check_health (),
@@ -99,10 +102,8 @@ async def shutdown(self) -> None:
99102 if self ._task_health_check :
100103 assert self ._started_event_task_health_check # nosec
101104 await self ._started_event_task_health_check .wait ()
102-
103- await cancel_wait_task (
104- self ._task_health_check , max_delay = _HEALTHCHECK_TIMEOUT_S
105- )
105+ self ._cancelled_event_task_health_check .set ()
106+ await cancel_wait_task (self ._task_health_check , max_delay = None )
106107
107108 await self ._client .aclose (close_connection_pool = True )
108109
You can’t perform that action at this time.
0 commit comments