Skip to content

Commit

Permalink
refactor: use yield from in connections attempts
Browse files Browse the repository at this point in the history
  • Loading branch information
dvarrazzo committed Dec 1, 2023
1 parent 7dc5852 commit be554d7
Showing 1 changed file with 2 additions and 4 deletions.
6 changes: 2 additions & 4 deletions psycopg/psycopg/conninfo.py
Original file line number Diff line number Diff line change
Expand Up @@ -294,11 +294,9 @@ def conninfo_attempts(params: ConnDict) -> Iterator[ConnDict]:
if params.get("load_balance_hosts", "disable") == "random":
attempts = list(_split_attempts(_inject_defaults(params)))
shuffle(attempts)
for attempt in attempts:
yield attempt
yield from attempts
else:
for attempt in _split_attempts(_inject_defaults(params)):
yield attempt
yield from _split_attempts(_inject_defaults(params))


async def conninfo_attempts_async(params: ConnDict) -> AsyncIterator[ConnDict]:
Expand Down

0 comments on commit be554d7

Please sign in to comment.