From 1fb6c38247e3a2bfe1df8877e5af9a1b36351d9d Mon Sep 17 00:00:00 2001 From: Mark Qvist Date: Wed, 1 Nov 2023 17:29:16 +0100 Subject: [PATCH] Cleanup --- sbapp/sideband/core.py | 18 ++++++++++++++---- setup.py | 2 +- 2 files changed, 15 insertions(+), 5 deletions(-) diff --git a/sbapp/sideband/core.py b/sbapp/sideband/core.py index 74e984a..d0968d3 100644 --- a/sbapp/sideband/core.py +++ b/sbapp/sideband/core.py @@ -1135,16 +1135,20 @@ class SidebandCore(): return [] def service_available(self): + now = time.time() service_heartbeat = self.getstate("service.heartbeat") if not service_heartbeat: + RNS.log("No service heartbeat available at "+str(now), RNS.LOG_DEBUG) return False else: try: - if time.time() - service_heartbeat > 2.5: + if now - service_heartbeat > 4.0: + RNS.log("Stale service heartbeat at "+str(now), RNS.LOG_DEBUG) return False else: return True - except: + except Exception as e: + RNS.log("Error while getting service heartbeat: "+str(e), RNS.LOG_ERROR) return False def gui_foreground(self): @@ -2608,8 +2612,11 @@ class SidebandCore(): if self.is_standalone or self.is_service: if self.config["start_announce"]: - self.lxmf_announce() - self.last_if_change_announce = time.time() + def da(): + time.sleep(8) + self.lxmf_announce() + self.last_if_change_announce = time.time() + threading.Thread(target=da, daemon=True).start() self.periodic_thread = threading.Thread(target=self._periodic_jobs, daemon=True) self.periodic_thread.start() @@ -3548,6 +3555,9 @@ class SidebandCore(): telemetry_stream.append(te) added += 1 + if len(telemetry_stream) == 0: + RNS.log(f"No new telemetry for request with timebase {timebase}", RNS.LOG_DEBUG) + return self.send_latest_telemetry( to_addr=to_addr, stream=telemetry_stream, diff --git a/setup.py b/setup.py index 07ececf..6f1b312 100644 --- a/setup.py +++ b/setup.py @@ -86,5 +86,5 @@ setuptools.setup( extras_require={ "macos": ["pyobjus"], }, - python_requires='>=3.8', + python_requires='>=3.7', )