Skip to content

Commit

Permalink
Make sure session is closed on any kind of exception
Browse files Browse the repository at this point in the history
But it doesn't handle session close when break is put on the user code which apparently needs an API breakage in order to happen sadly.
  • Loading branch information
ebraminio committed Nov 18, 2023
1 parent 1f99fee commit 1433061
Showing 1 changed file with 3 additions and 1 deletion.
4 changes: 3 additions & 1 deletion aiosseclient.py
Original file line number Diff line number Diff line change
Expand Up @@ -142,4 +142,6 @@ async def aiosseclient(
lines.append(line)
except TimeoutError as sseerr:
_LOGGER.error('TimeoutError: %s', sseerr)
await session.close()
finally:
if not session.closed:
await session.close()

0 comments on commit 1433061

Please sign in to comment.