Skip to content

Commit 2c7f3c3

Browse files
authored
Merge pull request #29 from jimbobbennett/master
Stop the reconnect infinite loop
2 parents 793e9bc + 2ab1f1e commit 2c7f3c3

File tree

1 file changed

+4
-2
lines changed

1 file changed

+4
-2
lines changed

adafruit_minimqtt.py

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -612,8 +612,10 @@ def reconnect(self, resub_topics=True):
612612
self.logger.debug(
613613
"Attempting to resubscribe to previously subscribed topics."
614614
)
615-
while self._subscribed_topics:
616-
feed = self._subscribed_topics.pop()
615+
subscribed_topics = self._subscribed_topics.copy()
616+
self._subscribed_topics = []
617+
while subscribed_topics:
618+
feed = subscribed_topics.pop()
617619
self.subscribe(feed)
618620

619621
def loop_forever(self):

0 commit comments

Comments
 (0)