diff --git a/python/idsse_common/idsse/common/publish_confirm.py b/python/idsse_common/idsse/common/publish_confirm.py index 801a647b..66074b66 100644 --- a/python/idsse_common/idsse/common/publish_confirm.py +++ b/python/idsse_common/idsse/common/publish_confirm.py @@ -142,7 +142,7 @@ def start(self): logger.debug('Starting thread') # not possible to start Thread when it's already running - if self._thread.is_alive() or self._connection is not None: + if self._thread.is_alive() or (self._connection is not None and self._connection.is_open): raise RuntimeError('PublishConfirm thread already running, cannot be started') self._start() @@ -166,7 +166,7 @@ def _run(self): time.sleep(0.2) while not self._stopping: - time.sleep(0.1) + time.sleep(.1) if self._connection is not None and not self._connection.is_closed: # Finish closing diff --git a/python/idsse_common/test/test_publish_confirm.py b/python/idsse_common/test/test_publish_confirm.py index f3d2d09b..7dbc9ea6 100644 --- a/python/idsse_common/test/test_publish_confirm.py +++ b/python/idsse_common/test/test_publish_confirm.py @@ -265,4 +265,4 @@ def test_calling_start_twice_raises_error(monkeypatch: MonkeyPatch, context: Moc pub_conf.start() with raises(RuntimeError) as exc: pub_conf.start() - assert exc is not None and exc.value.args[0] + assert exc is not None