Closed Olegt0rr closed 5 months ago
Then we discussed that we need to add something like that:
if asyncio.current_task().cancelling():
raise asyncio.CancelledError
Use delayed sse.stop_streaming()
instead of timeout
loop = asyncio.get_event_loop()
loop.call_later(delay, sse.stop_streaming)
await sse.wait()
No library should be swallowing CancelledError exceptions unconditionally like that, it will just break other people's applications.
https://github.com/aio-libs/aiohttp-sse/blob/7fdb4321a8e7951c6b27b80746f29332af34ffa4/aiohttp_sse/__init__.py#L138-L146
The problem is that your program won't stop when you explicitly told it to stop.
This program will never exit.
Originally posted by @Dreamsorcerer in https://github.com/aio-libs/aiohttp-sse/issues/456#issuecomment-1925751196