From 9734b1a5aff03874c60a70f518fb66b156636458 Mon Sep 17 00:00:00 2001 From: Matthew Keeler Date: Thu, 29 May 2025 13:40:01 -0400 Subject: [PATCH] fix: Catch all response.shutdown exceptions The response shutdown might trigger an exception for a number of reasons from within the urllib3 library. Since this is a shutdown procedure, and there isn't a way to recover at that point, we are going to simply catch all possible exceptions and continue to shutdown as gracefully as possible. --- ld_eventsource/http.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/ld_eventsource/http.py b/ld_eventsource/http.py index 05c4e3a..8d1096b 100644 --- a/ld_eventsource/http.py +++ b/ld_eventsource/http.py @@ -91,7 +91,7 @@ def connect(self, last_event_id: Optional[str]) -> Tuple[Iterator[bytes], Callab def close(): try: resp.shutdown() - except AttributeError: + except Exception: pass resp.release_conn()