Skip to content

Commit 2d86ac8

Browse files
committed
connection: Fix waiter wakeup code in _cancel_current_command
1 parent fe5cfaf commit 2d86ac8

File tree

1 file changed

+2
-1
lines changed

1 file changed

+2
-1
lines changed

asyncpg/connection.py

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -471,7 +471,8 @@ async def cancel():
471471
except Exception as ex:
472472
waiter.set_exception(ex)
473473
finally:
474-
waiter.set_result(None)
474+
if not waiter.done(): # Ensure set_exception wasn't called.
475+
waiter.set_result(None)
475476
w.close()
476477

477478
self._loop.create_task(cancel())

0 commit comments

Comments
 (0)