Skip to content

Commit

Permalink
datablob has to clear client id now
Browse files Browse the repository at this point in the history
  • Loading branch information
robcarver17 committed Dec 7, 2020
1 parent 7c98547 commit 594fd44
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 3 deletions.
6 changes: 3 additions & 3 deletions sysbrokers/IB/ib_connection.py
Original file line number Diff line number Diff line change
Expand Up @@ -88,6 +88,9 @@ def __init__(
def __repr__(self):
return "IB broker connection" + str(self._ib_connection_config)

def client_id(self):
return self._ib_connection_config["client"]

def close_connection(self):
self.log.msg("Terminating %s" % str(self._ib_connection_config))
try:
Expand All @@ -97,8 +100,5 @@ def close_connection(self):
self.log.warn(
"Trying to disconnect IB client failed... ensure process is killed"
)
finally:
self.db_id_tracker.release_clientid(
self._ib_connection_config["client"])


2 changes: 2 additions & 0 deletions sysdata/data_blob.py
Original file line number Diff line number Diff line change
Expand Up @@ -229,6 +229,8 @@ def __exit__(self, exc_type, exc_val, exc_tb):
def close(self):
if self._ib_conn is not arg_not_supplied:
self.ib_conn.close_connection()
self.db_ib_broker_client_id.release_clientid(
self.ib_conn.client_id())

# No need to explicitly close Mongo connections; handled by Python garbage collection

Expand Down

0 comments on commit 594fd44

Please sign in to comment.