Ensure that the PubSub is connected
(self)
| 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, |
no test coverage detected