This commit is contained in:
Mark Qvist 2023-11-01 17:29:16 +01:00
parent 8731be2293
commit 1fb6c38247
2 changed files with 15 additions and 5 deletions

View File

@ -1135,16 +1135,20 @@ class SidebandCore():
return [] return []
def service_available(self): def service_available(self):
now = time.time()
service_heartbeat = self.getstate("service.heartbeat") service_heartbeat = self.getstate("service.heartbeat")
if not service_heartbeat: if not service_heartbeat:
RNS.log("No service heartbeat available at "+str(now), RNS.LOG_DEBUG)
return False return False
else: else:
try: 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 return False
else: else:
return True return True
except: except Exception as e:
RNS.log("Error while getting service heartbeat: "+str(e), RNS.LOG_ERROR)
return False return False
def gui_foreground(self): def gui_foreground(self):
@ -2608,8 +2612,11 @@ class SidebandCore():
if self.is_standalone or self.is_service: if self.is_standalone or self.is_service:
if self.config["start_announce"]: if self.config["start_announce"]:
def da():
time.sleep(8)
self.lxmf_announce() self.lxmf_announce()
self.last_if_change_announce = time.time() 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 = threading.Thread(target=self._periodic_jobs, daemon=True)
self.periodic_thread.start() self.periodic_thread.start()
@ -3548,6 +3555,9 @@ class SidebandCore():
telemetry_stream.append(te) telemetry_stream.append(te)
added += 1 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( return self.send_latest_telemetry(
to_addr=to_addr, to_addr=to_addr,
stream=telemetry_stream, stream=telemetry_stream,

View File

@ -86,5 +86,5 @@ setuptools.setup(
extras_require={ extras_require={
"macos": ["pyobjus"], "macos": ["pyobjus"],
}, },
python_requires='>=3.8', python_requires='>=3.7',
) )