Skip to content

Commit ee1c63f

Browse files
committed
MOD: Attempt to write EOF on terminate
1 parent 02d6c17 commit ee1c63f

File tree

2 files changed

+10
-6
lines changed

2 files changed

+10
-6
lines changed

CHANGELOG.md

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,10 @@
11
# Changelog
22

3-
### 0.49.0 - TBD
3+
## 0.49.0 - TBD
44

5-
##### Enhancements
5+
#### Enhancements
66
- Added a `keep_zip` parameter to `Historical.batch.download()`. When `True`, and downloading all files, the jobs contents will be saved as a ZIP file
7+
- Calling `Live.terminate()` will now attempt to write EOF before aborting the connection to help close the remote end
78

89
## 0.48.0 - 2025-01-21
910

databento/live/session.py

Lines changed: 7 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -510,10 +510,13 @@ def subscribe(
510510
)
511511

512512
def terminate(self) -> None:
513-
if self._transport is None:
514-
return
515-
self._transport.abort()
516-
self._cleanup()
513+
with self._lock:
514+
if self._transport is None:
515+
return
516+
if self._transport.can_write_eof():
517+
self._transport.write_eof()
518+
self._transport.abort()
519+
self._cleanup()
517520

518521
async def wait_for_close(self) -> None:
519522
"""

0 commit comments

Comments
 (0)