Skip to content

Commit

Permalink
Merge pull request #590 from dvarrazzo/fix-set-changed-size
Browse files Browse the repository at this point in the history
Fix possible error iterating on connection channels during concurrent update
  • Loading branch information
mosquito committed Oct 26, 2023
2 parents 440ca72 + cf10462 commit 0954d40
Showing 1 changed file with 3 additions and 1 deletion.
4 changes: 3 additions & 1 deletion aio_pika/robust_connection.py
Original file line number Diff line number Diff line change
Expand Up @@ -95,7 +95,9 @@ async def _on_connected(self) -> None:
raise RuntimeError("No active transport for connection %r", self)

try:
for channel in self.__channels:
# Make a copy of the channels to iterate on, to guard from
# concurrent updates to the set.
for channel in tuple(self.__channels):
try:
await channel.restore()
except Exception:
Expand Down

0 comments on commit 0954d40

Please sign in to comment.