Handle disconnect
Disconnect events need to be handled properly. Currently an exception is raised:
Exception in callback PulsarMessageHandler.receive_request()
handle: <Handle PulsarMessageHandler.receive_request()>
Traceback (most recent call last):
File "/usr/lib/python3.6/asyncio/events.py", line 127, in _run
self._callback(*self._args)
File "/home/gfz-gi/eggert/workspace/gfz_similarity/venv/src/demessaging/demessaging/PulsarMessageHandler.py", line 93, in receive_request
msg = json.loads(self.subscription.recv())
File "/usr/lib/python3.6/json/__init__.py", line 354, in loads
return _default_decoder.decode(s)
File "/usr/lib/python3.6/json/decoder.py", line 339, in decode
raise JSONDecodeError("Expecting value", s, err.value) from None
json.decoder.JSONDecodeError: Expecting value: line 1 column 1 (char 0)
Exception in callback PulsarMessageHandler.receive_request()
handle: <Handle PulsarMessageHandler.receive_request()>
Traceback (most recent call last):
File "/usr/lib/python3.6/asyncio/events.py", line 127, in _run
self._callback(*self._args)
File "/home/gfz-gi/eggert/workspace/gfz_similarity/venv/src/demessaging/demessaging/PulsarMessageHandler.py", line 93, in receive_request
msg = json.loads(self.subscription.recv())
File "/home/gfz-gi/eggert/workspace/gfz_similarity/venv/lib/python3.6/site-packages/websocket/_core.py", line 314, in recv
opcode, data = self.recv_data()
File "/home/gfz-gi/eggert/workspace/gfz_similarity/venv/lib/python3.6/site-packages/websocket/_core.py", line 331, in recv_data
opcode, frame = self.recv_data_frame(control_frame)
File "/home/gfz-gi/eggert/workspace/gfz_similarity/venv/lib/python3.6/site-packages/websocket/_core.py", line 344, in recv_data_frame
frame = self.recv_frame()
File "/home/gfz-gi/eggert/workspace/gfz_similarity/venv/lib/python3.6/site-packages/websocket/_core.py", line 378, in recv_frame
return self.frame_buffer.recv_frame()
File "/home/gfz-gi/eggert/workspace/gfz_similarity/venv/lib/python3.6/site-packages/websocket/_abnf.py", line 361, in recv_frame
self.recv_header()
File "/home/gfz-gi/eggert/workspace/gfz_similarity/venv/lib/python3.6/site-packages/websocket/_abnf.py", line 309, in recv_header
header = self.recv_strict(2)
File "/home/gfz-gi/eggert/workspace/gfz_similarity/venv/lib/python3.6/site-packages/websocket/_abnf.py", line 396, in recv_strict
bytes_ = self.recv(min(16384, shortage))
File "/home/gfz-gi/eggert/workspace/gfz_similarity/venv/lib/python3.6/site-packages/websocket/_core.py", line 453, in _recv
return recv(self.sock, bufsize)
File "/home/gfz-gi/eggert/workspace/gfz_similarity/venv/lib/python3.6/site-packages/websocket/_socket.py", line 115, in recv
"Connection is already closed.")
websocket._exceptions.WebSocketConnectionClosedException: Connection is already closed.
Edited by Daniel Eggert