Skip to content

Commit

Permalink
Fix issue where flusher task stops running
Browse files Browse the repository at this point in the history
Fixes issue #624

A cancelled future in the flush_queue can cause the flusher task to fail with InvalidStateError, due to attempting to set the result on a "done" future.

Signed-off-by: Debby Mendez <[email protected]>
  • Loading branch information
debbyglance authored and vivamexico committed Nov 19, 2024
1 parent 7e7883e commit 97bb402
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 97bb402

Please sign in to comment.