sysid / sse-starlette

BSD 3-Clause "New" or "Revised" License
504 stars 35 forks source link

[#89] Add SSE Send Timeout #90

Closed blodow closed 5 months ago

blodow commented 5 months ago

As described in #89, this adds a send_timeout parameter to the EventSourceResponse initializer. In the event of the send call inside the response's sending logic exceeding this duration, a SendTimeoutError is raised, aborting the SSE event generator and effectively canceling the HTTP connection.

sysid commented 5 months ago

@blodow, thank you for this PR, much appreciated! Please give me some time to review it properly.

sysid commented 5 months ago

@blodow , following feedback

  1. Your use-case is valid and your PR as well.
  2. make test was not working, which I fixed.

After upgrade dependecies:

  1. tests via make tox are breaking for python 12: anyio has got breaking changes: ExceptionGroups

At this point I need to stop due to time constraints. However, make tox needs to pass in order to get the PR merged. Maybe you can have a look at it.

blodow commented 5 months ago

@sysid I think I managed to fix the remaining issues in a sort of minimally-invasive way. Let me know if you would like to see any other changes.