async def connect(self, timeout=None): """ Переопределяем метод для использования кастомной функции get_url """ url = self.get_url() logger.info(f'Connecting to RMQ {censor_url(url)}') self.connection = await asyncio.wait_for( aiormq.connect(url), timeout=timeout, loop=self.loop ) # type: aiormq.Connection self.connection.closing.add_done_callback(partial(self._on_connection_close, self.connection)) self.first_connect = False logger.info(f'Successful connected to RMQ {censor_url(url)}')
async def connect(self, timeout: TimeoutError = None): """ Connect to AMQP server. This method should be called after :func:`aio_pika.connection.Connection.__init__` .. note:: This method is called by :func:`connect`. You shouldn't call it explicitly. """ self.connection = await asyncio.wait_for(aiormq.connect(self.url), timeout=timeout ) # type: aiormq.Connection self.connection.closing.add_done_callback( partial(self._on_connection_close, self.connection))