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')