diff --git a/src/revpi_middleware/daemon.py b/src/revpi_middleware/daemon.py index 202090b..06e3dc8 100644 --- a/src/revpi_middleware/daemon.py +++ b/src/revpi_middleware/daemon.py @@ -129,6 +129,17 @@ class MiddlewareDaemon: self._reconfigure = False pi.startup_complete() + # Monitor bus providers for errors and restart them + restart = False + if not (self.bp_middleware1 and self.bp_middleware1.is_alive()): + log.warning("dbus middleware1 provider thread is not alive - restarting") + restart = True + if not (self.bp_ios1 and self.bp_ios1.is_alive()): + log.warning("dbus ios1 provider thread is not alive - restarting") + restart = True + if restart: + self.dbus_start() + # Cycle time calculation dm = divmod(ot - perf_counter(), self._cycle_time) # For float the result is (q, a % b), where q is usually math.floor(a / b) but may be 1 less than that.