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

Method connect

redis/asyncio/client.py:1125–1143  ·  view source on GitHub ↗

Ensure that the PubSub is connected

(self)

Source from the content-addressed store, hash-verified

1123 await self._execute(connection, connection.send_command, *args, **kwargs)
1124
1125 async def connect(self):
1126 """
1127 Ensure that the PubSub is connected
1128 """
1129 if self.connection is None:
1130 self.connection = await self.connection_pool.get_connection()
1131 # register a callback that re-subscribes to any channels we
1132 # were listening to when we were disconnected
1133 self.connection.register_connect_callback(self.on_connect)
1134 else:
1135 await self.connection.connect()
1136 if self.push_handler_func is not None:
1137 self.connection._parser.set_pubsub_push_handler(self.push_handler_func)
1138
1139 self._event_dispatcher.dispatch(
1140 AfterPubSubConnectionInstantiationEvent(
1141 self.connection, self.connection_pool, ClientType.ASYNC, self._lock
1142 )
1143 )
1144
1145 async def _reconnect(
1146 self,

Callers 10

execute_commandMethod · 0.95
runMethod · 0.95
_execute_commandMethod · 0.45
_reconnectMethod · 0.45
try_readMethod · 0.45
_reconnectMethod · 0.45
parse_responseMethod · 0.45
get_connectionMethod · 0.45
send_packed_commandMethod · 0.45
send_packed_commandMethod · 0.45

Calls 5

get_connectionMethod · 0.45
dispatchMethod · 0.45

Tested by

no test coverage detected