Skip to content
This repository was archived by the owner on Dec 12, 2023. It is now read-only.

Commit 9173d35

Browse files
committed
listener: add explicit timeout
1 parent 9f85ee6 commit 9173d35

File tree

1 file changed

+4
-0
lines changed

1 file changed

+4
-0
lines changed

linkedin_messaging/linkedin.py

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -523,6 +523,10 @@ async def _listen_to_event_stream(self):
523523
async with self.session.get(
524524
REALTIME_CONNECT_URL,
525525
headers={"content-type": "text/event-stream", **REQUEST_HEADERS},
526+
# The event stream normally stays open for about 3 minutes, but this will
527+
# automatically close it more agressively so that we don't get into a weird
528+
# state where it's not receiving any data, but simultaneously isn't closed.
529+
timeout=120,
526530
) as resp:
527531
if resp.status != 200:
528532
raise Exception(f"Failed to connect. Status {resp.status}.")

0 commit comments

Comments
 (0)