From: Cory Johns Date: Wed, 8 Mar 2017 14:39:56 +0000 (-0600) Subject: Don't raise ConnectionClosed error in receiver task X-Git-Tag: 0.4.0~13^2 X-Git-Url: https://osm.etsi.org/gitweb/?a=commitdiff_plain;h=502464d629d4e525e0ba68e8dbdf5632b3808596;p=osm%2FN2VC.git Don't raise ConnectionClosed error in receiver task --- diff --git a/juju/client/connection.py b/juju/client/connection.py index b9eb3bc..3ee8f16 100644 --- a/juju/client/connection.py +++ b/juju/client/connection.py @@ -97,9 +97,11 @@ class Connection: await self.messages.put(result['request-id'], result) except Exception as e: await self.messages.put_all(e) + if isinstance(e, websockets.ConnectionClosed): + # ConnectionClosed is not really exceptional for us, + # but it may be for any pending message listeners + return raise - await self.messages.put_all(websockets.exceptions.ConnectionClosed( - 0, 'websocket closed')) async def rpc(self, msg, encoder=None): self.__request_id__ += 1