Skip to content

Commit

Permalink
Fix issue #624
Browse files Browse the repository at this point in the history
A cancelled future in the flush_queue can cause the flusher task to fail with InvalidStateError, attempting to set the result on a "done" future.
  • Loading branch information
debbyglance authored Oct 28, 2024
1 parent 7e7883e commit 9da71e1
Showing 1 changed file with 3 additions and 1 deletion.
4 changes: 3 additions & 1 deletion nats/aio/client.py
Original file line number Diff line number Diff line change
Expand Up @@ -2084,7 +2084,9 @@ async def _flusher(self) -> None:
# RuntimeError in case the event loop is closed
break
finally:
future.set_result(None)
# future might have been cancelled. See issue #624
if not future.done():
future.set_result(None)

async def _ping_interval(self) -> None:
while True:
Expand Down

0 comments on commit 9da71e1

Please sign in to comment.