Skip to content

Commit 77f7f3b

Browse files
committed
MOD: Call Live.stop on garbage collection
1 parent 2d41f84 commit 77f7f3b

File tree

2 files changed

+7
-0
lines changed

2 files changed

+7
-0
lines changed

CHANGELOG.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,7 @@
44

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

89
## 0.36.0 - 2024-06-11
910

databento/live/client.py

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -121,6 +121,12 @@ def factory() -> _SessionProtocol:
121121
if not Live._thread.is_alive():
122122
Live._thread.start()
123123

124+
def __del__(self) -> None:
125+
try:
126+
self.stop()
127+
except ValueError:
128+
pass
129+
124130
def __aiter__(self) -> LiveIterator:
125131
return iter(self)
126132

0 commit comments

Comments
 (0)