@@ -342,26 +342,17 @@ asyncio event loop, so please ensure that `check_health` method is async:
342342
343343.. code-block :: python
344344
345- from redis.asyncio.multidb.healthcheck import AbstractHealthCheck
346- from redis.asyncio import Connection
347-
348- class PingHealthCheck (AbstractHealthCheck ):
349- def __init__ (
350- self ,
351- health_check_probes : int = 10 ,
352- health_check_delay : float = 0.1 ,
353- health_check_timeout : float = 2 ,
354- ):
355- super ().__init__ (
356- health_check_probes = health_check_probes,
357- health_check_delay = health_check_delay,
358- health_check_timeout = health_check_timeout,
359- )
345+ from redis.asyncio.multidb.healthcheck import AbstractHealthCheck, AsyncRedisClientT
346+
347+ class EchoHealthCheck (AbstractHealthCheck ):
348+ """
349+ Health check based on ECHO command.
350+ """
360351
361- async def check_health (self , database , connection : Connection ) -> bool :
362- await connection.send_command(" PING " )
352+ async def check_health (self , database , hc_client : AsyncRedisClientT ) -> bool :
353+ await connection.send_command(" ECHO " , " healthcheck " )
363354 response = await connection.read_response()
364- return response in (b " PONG " , " PONG " )
355+ return response in (b " healthcheck " , " healthcheck " )
365356
366357 Failure Detection (Reactive Monitoring)
367358-----------------
0 commit comments