Skip to content

Commit

Permalink
🐛 disable health check for Redis client (#5946)
Browse files Browse the repository at this point in the history
Co-authored-by: Andrei Neagu <neagu@itis.swiss>
  • Loading branch information
GitHK and Andrei Neagu authored Jun 14, 2024
1 parent 0d4985e commit 7b2d66a
Showing 1 changed file with 10 additions and 7 deletions.
17 changes: 10 additions & 7 deletions packages/service-library/src/servicelib/redis.py
Original file line number Diff line number Diff line change
Expand Up @@ -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

Expand Down Expand Up @@ -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:
Expand Down Expand Up @@ -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",
Expand Down

0 comments on commit 7b2d66a

Please sign in to comment.