From aed6f8e0ce4fa860d2c8a64462742b761db4bb72 Mon Sep 17 00:00:00 2001 From: Guillaume Boutry Date: Wed, 18 Sep 2024 13:33:34 +0200 Subject: [PATCH] fix(connection): wrap reconnect in a task It it forbidden to pass a coroutine to `asyncio.wait` in python3.11+. Closes-Bug: #1102 Signed-off-by: Guillaume Boutry --- juju/client/connection.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/juju/client/connection.py b/juju/client/connection.py index 45ee6d95e..cb87f118e 100644 --- a/juju/client/connection.py +++ b/juju/client/connection.py @@ -656,7 +656,7 @@ async def rpc(self, msg, encoder=None): # if it is triggered by the pinger, then this RPC call will # be cancelled when the pinger is cancelled by the reconnect, # and we don't want the reconnect to be aborted halfway through - await jasyncio.wait([self.reconnect()]) + await jasyncio.wait([jasyncio.create_task(self.reconnect())]) if self.monitor.status != Monitor.CONNECTED: # reconnect failed; abort and shutdown log.error('RPC: Automatic reconnect failed')