error handling improved
This commit is contained in:
@ -35,9 +35,8 @@ class MqttPublish(AbstractMqttPublisher):
|
||||
payload = { "count": cnt, "uptime": uptime }
|
||||
self.client.publish(self.statusTopic, json.dumps(payload), retain=True)
|
||||
except Empty:
|
||||
if self.killBill:
|
||||
logger.error("killbill received")
|
||||
break
|
||||
# just evaluate the killBill at the top of the loop again
|
||||
pass
|
||||
except Exception as e:
|
||||
logger.error(f"Exception {type(e)} received in MQTT local loop: {e}")
|
||||
|
||||
|
@ -38,8 +38,10 @@ class OpcUaRequester(threading.Thread):
|
||||
except ua.UaError as e:
|
||||
logger.error(f"UaError in inner OPC-UA loop: {type(e)} {e}")
|
||||
await asyncio.sleep(self.delay)
|
||||
except TimeoutError as e:
|
||||
except asyncio.exceptions.TimeoutError as e:
|
||||
logger.error(f"Timeout in inner OPC-UA loop")
|
||||
except Exception as e:
|
||||
logger.error(f"Exception in inner OPC-UA loop: {type(e)} {e}")
|
||||
|
||||
def run(self):
|
||||
loop = asyncio.new_event_loop()
|
||||
|
Reference in New Issue
Block a user