Return the shared PushoverService, creating it once if needed.
()
| 845 | tmp = f"{path}.tmp" |
| 846 | with open(tmp, 'w') as fh: |
| 847 | json.dump(lst, fh) |
| 848 | os.replace(tmp, path) |
| 849 | except OSError as exc: |
| 850 | logger.error(f"[rusense] failed to persist vitals history: {exc}") |
| 851 | |
| 852 | |
| 853 | def _rusense_vitals_record(now, vs, present): |
| 854 | """Fold one ~1 Hz notify pass into the current 5-min bucket; when the |
| 855 | bucket rolls over, compact the finished one into the persisted history. |
| 856 | Every pass contributes to the activity duty; HR/BR contribute only at |
| 857 | display-grade confidence (>= 0.3 — below that the engine is guessing). |
| 858 | A restart loses at most the one in-progress bucket.""" |
| 859 | bucket_t = int(now - (now % _RUSENSE_VITALS_BUCKET_S)) |
| 860 | with _rusense_vitals_lock: |
| 861 | cur = _rusense_notify_state.get('vitals_bucket') |
no test coverage detected