Commit f622912c authored by Daniel Eggert's avatar Daniel Eggert
Browse files

fixed reconnection bug

parent 6f0d2235
......@@ -103,7 +103,7 @@ class PulsarMessageHandler:
def _pulsar_ping(self, timeout, event: threading.Event):
while not event.wait(timeout):
if self.subscription:
if self.subscription and self.subscription.connected:
try:
# print('ping {}'.format(datetime.now()))
self.subscription.ping()
......@@ -143,8 +143,15 @@ class PulsarMessageHandler:
self.loop.stop()
self.disconnect()
elif self.subscription:
# the already is a subscription - remove it from the loop
self.loop.remove_reader(self.subscription)
# there already is a subscription - remove it from the loop
# in case the subscription is not connected anymore the reader has been already removed
if self.subscription.connected:
# only try to remove the subscription reader if still connected
try:
self.loop.remove_reader(self.subscription)
except ValueError:
print('ignoring exception in remove reader during reconnect')
# disconnect and (re-)connect
self.connect()
......
......@@ -2,7 +2,7 @@ from setuptools import setup
setup(
name='demessaging',
version='0.0.8',
version='0.0.9',
description='basic back-end messaging module for the digital earth framework',
license='TBD',
packages=['demessaging'],
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment