Skip to content

Commit

Permalink
Fix possible error iterating on connection channels during concurrent…
Browse files Browse the repository at this point in the history
… update

Fix for the crash reported in mosquito#589 unfortunately not tested to verify if
the fix is complete.
  • Loading branch information
dvarrazzo committed Oct 16, 2023
1 parent 0e5db7f commit 4d0dd6a
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 list(self.__channels):
try:
await channel.restore()
except Exception:
Expand Down

0 comments on commit 4d0dd6a

Please sign in to comment.