Skip to content

Commit

Permalink
MOD: Call Live.stop on garbage collection
Browse files Browse the repository at this point in the history
  • Loading branch information
nmacholl committed Jun 17, 2024
1 parent 2d41f84 commit 77f7f3b
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 0 deletions.
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@

#### Enhancements
- Added type alias `TBBOMsg` for `MBP1Msg`
- Instances of the `Live` client will now call `Live.stop` when garbage collected

## 0.36.0 - 2024-06-11

Expand Down
6 changes: 6 additions & 0 deletions databento/live/client.py
Original file line number Diff line number Diff line change
Expand Up @@ -121,6 +121,12 @@ def factory() -> _SessionProtocol:
if not Live._thread.is_alive():
Live._thread.start()

def __del__(self) -> None:
try:
self.stop()
except ValueError:
pass

def __aiter__(self) -> LiveIterator:
return iter(self)

Expand Down

0 comments on commit 77f7f3b

Please sign in to comment.