Skip to content

Commit

Permalink
Close internal SelectConnection resources
Browse files Browse the repository at this point in the history
Pulling out of larger work on closing all resources for the recent broken CI.
  • Loading branch information
khk-globus committed Jan 15, 2025
1 parent 1cb7257 commit c29c0c0
Show file tree
Hide file tree
Showing 3 changed files with 14 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -149,6 +149,11 @@ def run(self) -> None:

except Exception:
log.exception("%r Unhandled error; event loop stopped", self)

finally:
if self._mq_conn and self._mq_conn.ioloop:
self._mq_conn.ioloop.close()

self._stop_event.set()

log.debug("%r thread ends.", self)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -142,10 +142,16 @@ def run(self):
self._connection = self._connect()
self._event_watcher()
self._connection.ioloop.start()

except Exception:
logger.exception(
"%s Unhandled exception: shutting down connection.", self
)

finally:
if self._connection and self._connection.ioloop:
self._connection.ioloop.close()

self._stop_event.set()
logger.debug("%s Shutdown complete", self)

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -323,6 +323,9 @@ def run(self):
self._connection.ioloop.start()
except Exception:
logger.exception("Failed to start subscriber")
finally:
if self._connection and self._connection.ioloop:
self._connection.ioloop.close()

def stop(self) -> None:
"""stop() is called by the parent to shutdown the subscriber"""
Expand Down

0 comments on commit c29c0c0

Please sign in to comment.