Skip to content

Commit

Permalink
event listener: disable timeout on request
Browse files Browse the repository at this point in the history
The timeout is now on waiting for a line (which is 20 seconds) and that
should only happen if we aren't getting heartbeats or other messages.

Signed-off-by: Sumner Evans <[email protected]>
  • Loading branch information
sumnerevans committed Jan 18, 2024
1 parent 667dd9b commit 564ee2b
Showing 1 changed file with 3 additions and 2 deletions.
5 changes: 3 additions & 2 deletions linkedin_messaging/linkedin.py
Original file line number Diff line number Diff line change
Expand Up @@ -126,7 +126,7 @@ class LinkedInMessaging:
list[
Union[
Callable[[RealTimeEventStreamEvent], Awaitable[None]],
Callable[[asyncio.exceptions.TimeoutError], Awaitable[None]],
Callable[[asyncio.TimeoutError], Awaitable[None]],
Callable[[Exception], Awaitable[None]],
]
],
Expand Down Expand Up @@ -525,7 +525,7 @@ def add_event_listener(
payload_key: str,
fn: Union[
Callable[[RealTimeEventStreamEvent], Awaitable[None]],
Callable[[asyncio.exceptions.TimeoutError], Awaitable[None]],
Callable[[asyncio.TimeoutError], Awaitable[None]],
Callable[[Exception], Awaitable[None]],
],
):
Expand Down Expand Up @@ -554,6 +554,7 @@ async def _listen_to_event_stream(self):
REALTIME_CONNECT_URL,
headers=headers,
params={"rc": "1"},
timeout=aiohttp.ClientTimeout(total=None),
) as resp:
if resp.status != 200:
raise TooManyRequestsError(f"Failed to connect. Status {resp.status}.")
Expand Down

0 comments on commit 564ee2b

Please sign in to comment.