Skip to content

Commit

Permalink
use copy of list
Browse files Browse the repository at this point in the history
  • Loading branch information
ric-evans committed Dec 1, 2023
1 parent b25345e commit db30936
Showing 1 changed file with 3 additions and 4 deletions.
7 changes: 3 additions & 4 deletions mqclient/broker_clients/rabbitmq.py
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,6 @@
AsyncGenerator,
AsyncIterator,
Dict,
Iterator,
List,
Optional,
Tuple,
Expand Down Expand Up @@ -385,7 +384,7 @@ def _get_msg():
# inf_channels_gen = infinite_loop_over_channels()
# channel = next(inf_channels_gen) # always called manually
# n_nonempty_channels_remaining = len(self.channels) # assume all are non-empty
remaining_channels = self.active_channels # start with all
remaining_channels = [c for c in self.active_channels] # start with all
channel = remaining_channels[0] # TODO - use by priority?

while True:
Expand Down Expand Up @@ -420,7 +419,7 @@ def _get_msg():
# if this was the reserve channel, move it to active channels
self.active_channels.append(self.reserve_channel)
self.reserve_channel = None # no need to open a new one now
remaining_channels = self.active_channels # reset!
remaining_channels = [c for c in self.active_channels] # reset!
yield msg
# DEAL WITH EMPTY CHANNEL (didn't get a message)
else:
Expand All @@ -430,7 +429,7 @@ def _get_msg():
# this means our reserve channel came up empty,
# so there's REALLY nothing in the queue
LOGGER.debug(log_msgs.GETMSG_NO_MESSAGE)
remaining_channels = self.active_channels # reset!
remaining_channels = [c for c in self.active_channels] # reset!
yield None
else:
remaining_channels.remove(channel)
Expand Down

0 comments on commit db30936

Please sign in to comment.