Skip to content

Commit

Permalink
#50 : Fix potential AttributeError for new configurations in case of …
Browse files Browse the repository at this point in the history
…mqtt error
  • Loading branch information
helldog136 committed May 15, 2022
1 parent 20a7c92 commit b11ee7f
Showing 1 changed file with 2 additions and 1 deletion.
3 changes: 2 additions & 1 deletion tuya_iot/openmq.py
Original file line number Diff line number Diff line change
Expand Up @@ -160,7 +160,6 @@ def run(self):
try:
self.__run_mqtt()
backoff_seconds = 1

# reconnect every 2 hours required.
time.sleep(self.mq_config.expire_time - 60)
except RequestException as e:
Expand All @@ -175,6 +174,8 @@ def __run_mqtt(self):
mq_config = self._get_mqtt_config()
if mq_config is None:
logger.error("error while get mqtt config")
if self.mq_config is None: # if we have no initial mq_config this is a big problem.
raise RequestException()
return

self.mq_config = mq_config
Expand Down

0 comments on commit b11ee7f

Please sign in to comment.