Skip to content

Commit

Permalink
Cleanup based on review comments
Browse files Browse the repository at this point in the history
  • Loading branch information
cderici committed Sep 22, 2023
1 parent 0de4fed commit a4b15a3
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 5 deletions.
5 changes: 2 additions & 3 deletions juju/client/connection.py
Original file line number Diff line number Diff line change
Expand Up @@ -433,7 +433,6 @@ def _exit_tasks():
max_size=self.max_frame_size,
server_hostname=server_hostname,
sock=sock,
close_timeout=1,
)), url, endpoint, cacert

async def close(self, to_reconnect=False):
Expand Down Expand Up @@ -645,7 +644,7 @@ async def rpc(self, msg, encoder=None):
if "version" not in msg:
msg['version'] = self.facades[msg['type']]
outgoing = json.dumps(msg, indent=2, cls=encoder)
log.debug('connection id: {} -- sending {}'.format(id(self), outgoing))
log.debug('connection id: {} ---> {}'.format(id(self), outgoing))
for attempt in range(3):
if self.monitor.status == Monitor.DISCONNECTED:
# closed cleanly; shouldn't try to reconnect
Expand All @@ -668,7 +667,7 @@ async def rpc(self, msg, encoder=None):
log.error('RPC: Automatic reconnect failed')
raise
result = await self._recv(msg['request-id'])
log.debug('connection id : {} -- receiving {}'.format(id(self), result))
log.debug('connection id : {} <--- {}'.format(id(self), result))

if not result:
return result
Expand Down
4 changes: 2 additions & 2 deletions juju/model.py
Original file line number Diff line number Diff line change
Expand Up @@ -771,7 +771,7 @@ async def watch_received_waiter():
raise JujuError("AllWatcher task is finished abruptly without an exception.")
raise self._watcher_task.exception()

if self.info is None:
if self._info is None:
# TODO (cderici): See if this can be optimized away, or at least
# be done lazily (i.e. not everytime after_connect, but whenever
# self.info is needed -- which here can be bypassed if model_uuid
Expand Down Expand Up @@ -799,7 +799,7 @@ async def disconnect(self):
self._watch_stopping.clear()

if self.is_connected():
await self._connector.disconnect(entity='Model')
await self._connector.disconnect(entity='model')
self._info = None

async def add_local_charm_dir(self, charm_dir, series):
Expand Down

0 comments on commit a4b15a3

Please sign in to comment.