diff --git a/aio_pika/robust_connection.py b/aio_pika/robust_connection.py index 254e089e..59f7a22b 100644 --- a/aio_pika/robust_connection.py +++ b/aio_pika/robust_connection.py @@ -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: