Skip to content

Commit

Permalink
[sapphire] Check and close connection in one place
Browse files Browse the repository at this point in the history
  • Loading branch information
tysmith committed Mar 30, 2023
1 parent 8ff7755 commit cf8f035
Showing 1 changed file with 2 additions and 4 deletions.
6 changes: 2 additions & 4 deletions sapphire/worker.py
Original file line number Diff line number Diff line change
Expand Up @@ -278,14 +278,12 @@ def launch(cls, listen_sock, job):
pass
except OSError as exc:
LOG.debug("worker thread not launched: %s", exc)
if conn is not None: # pragma: no cover
conn.close()
except ThreadError:
if conn is not None: # pragma: no cover
conn.close()
# reset accepting status
job.accepting.set()
LOG.warning("ThreadError (worker), threads: %d", active_count())
# wait for system resources to free up
sleep(0.1)
if conn is not None:
conn.close()
return None

0 comments on commit cf8f035

Please sign in to comment.