Skip to content

Commit

Permalink
Loop handling
Browse files Browse the repository at this point in the history
  • Loading branch information
Iture committed Nov 6, 2022
1 parent 6e1d6f3 commit cbe321e
Showing 1 changed file with 5 additions and 6 deletions.
11 changes: 5 additions & 6 deletions MQTTClient.py
Original file line number Diff line number Diff line change
Expand Up @@ -106,11 +106,10 @@ def run(self):
self.logger.error('Reconnecting, try:%s' % (self.connect_retry_counter+1))
self.connect(self.config)
self.connect_retry_counter += 1
if not self.__messageQ.empty():
task = self.__messageQ.get()
if task['method'] == 'publish':
self.publish(task)
else:
if not self.__messageQ.empty():
task = self.__messageQ.get()
if task['method'] == 'publish':
self.publish(task)
else:
time.sleep(0.1)
time.sleep(0.1)
self._mqttConn.loop()

0 comments on commit cbe321e

Please sign in to comment.