Skip to content

Commit

Permalink
Merge pull request #1103 from gboutry/fix/async-reconnect
Browse files Browse the repository at this point in the history
#1103

#### Description

Wrap reconnect coroutine in a task. This is due to a breaking change in python stdlib 3.11. Before 3.11 it only emitted a warning.

Fixes: #1102


All places calling asyncio.wait are already wrapping into a task:
https://github.com/juju/python-libjuju/blob/7d2107f882e5f7927001004dc2dac74a286740eb/juju/model.py#L757
https://github.com/juju/python-libjuju/blob/7d2107f882e5f7927001004dc2dac74a286740eb/juju/utils.py#L179
  • Loading branch information
jujubot authored Sep 26, 2024
2 parents c30f1c0 + aed6f8e commit bcbce1e
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion juju/client/connection.py
Original file line number Diff line number Diff line change
Expand Up @@ -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')
Expand Down

0 comments on commit bcbce1e

Please sign in to comment.