Skip to content

Commit

Permalink
fix: Ensure blocking read stream can be shutdown (#37)
Browse files Browse the repository at this point in the history
  • Loading branch information
keelerm84 authored Dec 23, 2024
1 parent 1872b4a commit 58c4702
Showing 1 changed file with 9 additions and 1 deletion.
10 changes: 9 additions & 1 deletion ld_eventsource/http.py
Original file line number Diff line number Diff line change
Expand Up @@ -87,7 +87,15 @@ def connect(self, last_event_id: Optional[str]) -> Tuple[Iterator[bytes], Callab
raise HTTPContentTypeError(content_type or '')

stream = resp.stream(_CHUNK_SIZE)
return stream, resp.release_conn

def close():
try:
resp.shutdown()
except AttributeError:
pass
resp.release_conn()

return stream, close

def close(self):
if self.__should_close_pool:
Expand Down

0 comments on commit 58c4702

Please sign in to comment.