Skip to content

Commit 58c4702

Browse files
authored
fix: Ensure blocking read stream can be shutdown (#37)
1 parent 1872b4a commit 58c4702

File tree

1 file changed

+9
-1
lines changed

1 file changed

+9
-1
lines changed

ld_eventsource/http.py

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -87,7 +87,15 @@ def connect(self, last_event_id: Optional[str]) -> Tuple[Iterator[bytes], Callab
8787
raise HTTPContentTypeError(content_type or '')
8888

8989
stream = resp.stream(_CHUNK_SIZE)
90-
return stream, resp.release_conn
90+
91+
def close():
92+
try:
93+
resp.shutdown()
94+
except AttributeError:
95+
pass
96+
resp.release_conn()
97+
98+
return stream, close
9199

92100
def close(self):
93101
if self.__should_close_pool:

0 commit comments

Comments
 (0)