From f1f59928f70e62ea29891a18722d554e54b6b068 Mon Sep 17 00:00:00 2001 From: Andrei Neagu Date: Fri, 14 Jun 2024 12:35:01 +0200 Subject: [PATCH] disable period task for health check Redis --- .../service-library/src/servicelib/redis.py | 17 ++++++++++------- 1 file changed, 10 insertions(+), 7 deletions(-) diff --git a/packages/service-library/src/servicelib/redis.py b/packages/service-library/src/servicelib/redis.py index d90f124be97..83e29d0b4f2 100644 --- a/packages/service-library/src/servicelib/redis.py +++ b/packages/service-library/src/servicelib/redis.py @@ -17,7 +17,7 @@ from settings_library.redis import RedisDatabase, RedisSettings from tenacity import retry -from .background_task import periodic_task, start_periodic_task, stop_periodic_task +from .background_task import periodic_task, stop_periodic_task from .logging_utils import log_catch, log_context from .retry_policies import RedisRetryPolicyUponInitialization @@ -54,7 +54,9 @@ class RedisClientSDK: _client: aioredis.Redis = field(init=False) _health_check_task: Task | None = None - _is_healthy: bool = False + _is_healthy: bool = ( + True # revert back to False when stop_periodic_task issue is fixed + ) @property def redis(self) -> aioredis.Redis: @@ -83,11 +85,12 @@ async def setup(self) -> None: raise CouldNotConnectToRedisError(dsn=self.redis_dsn) self._is_healthy = True - self._health_check_task = start_periodic_task( - self._check_health, - interval=self.health_check_interval, - task_name=f"redis_service_health_check_{self.redis_dsn}", - ) + # Disabled till issue with stop_periodic_task is fixed + # self._health_check_task = start_periodic_task( + # self._check_health, + # interval=self.health_check_interval, + # task_name=f"redis_service_health_check_{self.redis_dsn}", + # ) _logger.info( "Connection to %s succeeded with %s",