Skip to content

Commit

Permalink
more specific error check for is_started
Browse files Browse the repository at this point in the history
  • Loading branch information
mackenzie-grimes-noaa committed Dec 7, 2023
1 parent 72d61c4 commit c13794e
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 3 deletions.
4 changes: 2 additions & 2 deletions python/idsse_common/idsse/common/publish_confirm.py
Original file line number Diff line number Diff line change
Expand Up @@ -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()

Expand All @@ -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
Expand Down
2 changes: 1 addition & 1 deletion python/idsse_common/test/test_publish_confirm.py
Original file line number Diff line number Diff line change
Expand Up @@ -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

0 comments on commit c13794e

Please sign in to comment.