Skip to content

Commit

Permalink
Fix closing of connection discarded by session target attrs (#1046)
Browse files Browse the repository at this point in the history
`asyncio.gather` takes a variadic, not an iterable and
`return_exceptions` was masking the issue.
  • Loading branch information
elprans committed Jul 6, 2023
1 parent faa94d1 commit 6043d91
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion asyncpg/connect_utils.py
Expand Up @@ -1003,7 +1003,7 @@ async def _connect(*, loop, timeout, connection_class, record_class, **kwargs):
chosen_connection = random.choice(candidates)

await asyncio.gather(
(c.close() for c in candidates if c is not chosen_connection),
*(c.close() for c in candidates if c is not chosen_connection),
return_exceptions=True
)

Expand Down

0 comments on commit 6043d91

Please sign in to comment.