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

Method clean_health_check_responses

redis/client.py:1102–1118  ·  view source on GitHub ↗

If any health check responses are present, clean them

(self)

Source from the content-addressed store, hash-verified

1100 self._execute(connection, connection.send_command, *args, **kwargs)
1101
1102 def clean_health_check_responses(self) -> None:
1103 """
1104 If any health check responses are present, clean them
1105 """
1106 ttl = 10
1107 conn = self.connection
1108 while conn and self.health_check_response_counter > 0 and ttl > 0:
1109 if self._execute(conn, conn.can_read, timeout=conn.socket_timeout):
1110 response = self._execute(conn, conn.read_response)
1111 if self.is_health_check_response(response):
1112 self.health_check_response_counter -= 1
1113 else:
1114 raise PubSubError(
1115 "A non health check response was cleaned by "
1116 "execute_command: {}".format(response)
1117 )
1118 ttl -= 1
1119
1120 def _reconnect(
1121 self,

Callers 1

execute_commandMethod · 0.95

Calls 3

_executeMethod · 0.95
PubSubErrorClass · 0.90

Tested by

no test coverage detected