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