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

Method connect

redis/asyncio/connection.py:347–359  ·  view source on GitHub ↗

Connects to the Redis server if not already connected

(self)

Source from the content-addressed store, hash-verified

345 self._parser = parser_class(socket_read_size=self._socket_read_size)
346
347 async def connect(self):
348 """Connects to the Redis server if not already connected"""
349 # try once the socket connect with the handshake, retry the whole
350 # connect/handshake flow based on retry policy
351 await self.retry.call_with_retry(
352 lambda: self.connect_check_health(
353 check_health=True, retry_socket_connect=False
354 ),
355 lambda error, failure_count: self.disconnect(
356 error=error, failure_count=failure_count
357 ),
358 with_failure_count=True,
359 )
360
361 async def connect_check_health(
362 self, check_health: bool = True, retry_socket_connect: bool = True

Callers 1

ensure_connectionMethod · 0.45

Calls 3

connect_check_healthMethod · 0.95
disconnectMethod · 0.95
call_with_retryMethod · 0.45

Tested by

no test coverage detected