aio-libs / aiohttp-sse

Server-sent events support for aiohttp
Other
197 stars 36 forks source link

Cancel ping task on ConnectionResetError. #370

Closed jameshilliard closed 7 months ago

jameshilliard commented 1 year ago

What do these changes do?

Fixes:

  File "/usr/lib/python3.10/site-packages/aiohttp_sse/__init__.py", line 119, in wait
  File "/usr/lib/python3.10/site-packages/aiohttp_sse/__init__.py", line 157, in _ping
  File "/usr/lib/python3.10/site-packages/aiohttp/web_response.py", line 514, in write
  File "/usr/lib/python3.10/site-packages/aiohttp/http_writer.py", line 116, in write
  File "/usr/lib/python3.10/site-packages/aiohttp/http_writer.py", line 76, in _write
ConnectionResetError: Cannot write to closing transport

This issue appears to be related to #2989.

Are there changes in behavior for the user?

Calling await stream.wait() should no longer throw a ConnectionResetError if the client closes the connection unexpectedly.

Checklist

codecov[bot] commented 7 months ago

Codecov Report

All modified and coverable lines are covered by tests :white_check_mark:

Comparison is base (06adced) 99.49% compared to head (4dbaceb) 99.53%.

Additional details and impacted files ```diff @@ Coverage Diff @@ ## master #370 +/- ## ========================================== + Coverage 99.49% 99.53% +0.03% ========================================== Files 4 4 Lines 394 427 +33 Branches 45 45 ========================================== + Hits 392 425 +33 Misses 1 1 Partials 1 1 ```

:umbrella: View full report in Codecov by Sentry.
:loudspeaker: Have feedback on the report? Share it here.