MCPcopy
hub / github.com/redis/redis-py / is_health_check_response

Method is_health_check_response

redis/client.py:1275–1296  ·  view source on GitHub ↗

Check if the response is a health check response. If there are no subscriptions redis responds to PING command with a bulk response, instead of a multi-bulk with "pong" and the response.

(self, response)

Source from the content-addressed store, hash-verified

1273 return response
1274
1275 def is_health_check_response(self, response) -> bool:
1276 """
1277 Check if the response is a health check response.
1278 If there are no subscriptions redis responds to PING command with a
1279 bulk response, instead of a multi-bulk with "pong" and the response.
1280 """
1281 if self.encoder.decode_responses:
1282 return (
1283 response
1284 in [
1285 self.health_check_response, # If there is a subscription
1286 self.HEALTH_CHECK_MESSAGE, # If there are no subscriptions and decode_responses=True
1287 ]
1288 )
1289 else:
1290 return (
1291 response
1292 in [
1293 self.health_check_response, # If there is a subscription
1294 self.health_check_response_b, # If there isn't a subscription and decode_responses=False
1295 ]
1296 )
1297
1298 def check_health(self) -> None:
1299 conn = self.connection

Calls

no outgoing calls