pypi sse-starlette 3.7.0
v3.7.0

5 hours ago

Fixed

  • A generator whose finally gets stuck after an encoding failure or an interrupted
    send no longer keeps the response open forever (#217). Previously the background
    task never ran, and uvicorn without a graceful timeout could not finish shutting
    down.
  • Body iterators are now closed when SSE event encoding fails, so generator cleanup
    runs before the error escapes (#223).
  • Encoding no longer mutates event dictionaries yielded by a generator (#225).

Added

  • cleanup_timeout parameter on EventSourceResponse: seconds to wait for the
    generator's cleanup after an encoding failure or interrupted send. Default: 30.0.
    None means no limit.

Behaviour change

  • Cleanup that takes longer than 30s on this path is now cancelled, and a warning is
    logged. Pass a larger cleanup_timeout, or None, to allow more time.
  • The deadline only reaches cleanup that can be cancelled. A nested shield or a
    blocking call in finally can still hang.

Dependencies

  • Upgraded locked dependencies, including Twisted 26.10.0, which addresses open
    security advisories against Twisted 26.4.0 and earlier. The lockfile does not ship
    with the package: if you use Daphne, make sure your own environment has Twisted
    26.10.0 or later.

What's Changed

  • Close body iterators when SSE event encoding fails by @Claire-ovo in #223
  • fix: avoid mutating event dictionaries during encoding by @HuaTNA in #225
  • fix: bound shielded iterator cleanup with cleanup_timeout by @sysid in #234

New Contributors

Full Changelog: v3.6.0...v3.7.0

Don't miss a new sse-starlette release

NewReleases is sending notifications on new releases.