- Python version: 3.10.4
- Operating System: macOS 12.4 (21F79)
- aiohttp version: 3.8.1
This is related to #2 but is not a duplicate as it concerns documentation, and the previous issue was closed before the circumstances of the timeout were fully understood.
Description
-
Regardless of keep-alive activity, the default usage of sse_client.EventSource as given in the README times out after 5 minutes:
async with sse_client.EventSource(
'https://stream.wikimedia.org/v2/stream/recentchange'
) as event_source:
...
-
There is no documentation in the README to state that this will occur.
Resolution
Ideally one of two things would resolve this issue:
-
Remove the default timeout, which is what aiosseclient does.
-
If there is sufficient* justification to keep the timeout, then document the justification and the workaround in the README:
Timeouts
Note that aiohttp requests have a default timeout of 5 minutes, inclusive of all traffic—that is, all aiohttp-sse-client requests will unconditionally time out after 5 minutes regardless of activity. This default has been retained in aiohttp-sse-client because ...
To prevent this behaviour, disable the timeout by passing a timeout argument to the underlying request call:
async with sse_client.EventSource(
'https://stream.wikimedia.org/v2/stream/recentchange',
timeout=None,
) as event_source:
...
- It's important to note that this default timeout fires unconditionally, even if keep-alive activity occurs, and exists in
aiohttp because it is a sensible default for normal traffic (not long-running SSE traffic).
This is related to #2 but is not a duplicate as it concerns documentation, and the previous issue was closed before the circumstances of the timeout were fully understood.
Description
Regardless of keep-alive activity, the default usage of
sse_client.EventSourceas given in the README times out after 5 minutes:There is no documentation in the README to state that this will occur.
Resolution
Ideally one of two things would resolve this issue:
Remove the default timeout, which is what
aiosseclientdoes.If there is sufficient* justification to keep the timeout, then document the justification and the workaround in the README:
aiohttpbecause it is a sensible default for normal traffic (not long-running SSE traffic).