diff --git a/adafruit_minimqtt.py b/adafruit_minimqtt.py index 063a065..5fa7b92 100644 --- a/adafruit_minimqtt.py +++ b/adafruit_minimqtt.py @@ -612,8 +612,10 @@ def reconnect(self, resub_topics=True): self.logger.debug( "Attempting to resubscribe to previously subscribed topics." ) - while self._subscribed_topics: - feed = self._subscribed_topics.pop() + subscribed_topics = self._subscribed_topics.copy() + self._subscribed_topics = [] + while subscribed_topics: + feed = subscribed_topics.pop() self.subscribe(feed) def loop_forever(self):