From 3256aa8be90813fca399a51d79882a43446168c1 Mon Sep 17 00:00:00 2001 From: Mario Date: Mon, 2 Mar 2026 07:34:43 +0000 Subject: [PATCH] only poll perfstats if the widget id actually visible (the widget is mostly hidden when viewing content in HQ) --- view/tpl/system_status_widget.tpl | 17 ++++++++++++++++- 1 file changed, 16 insertions(+), 1 deletion(-) diff --git a/view/tpl/system_status_widget.tpl b/view/tpl/system_status_widget.tpl index c618e56ac..7d704dd0a 100644 --- a/view/tpl/system_status_widget.tpl +++ b/view/tpl/system_status_widget.tpl @@ -21,6 +21,10 @@ last_q: 0, updateStatus: function () { + if (!this.isVisible()) { + return; + } + fetch('/perfstats', { headers: { "Accept": "application/json", @@ -30,7 +34,7 @@ .then((response) => response.json()) .then((json) => { for (const item in json) { - element = document.getElementById(`perfstat-${item}-value`); + const element = document.getElementById(`perfstat-${item}-value`); if (element) { if (item === "loadavg") { element.innerText = json['loadavg'] @@ -57,6 +61,17 @@ start: function() { this.updateStatus(); setInterval(() => this.updateStatus(), 5000); + }, + + isVisible: function () { + const element = document.getElementById('channel-activities'); + + if (!element) { + return false; + } + + const style = window.getComputedStyle(element); + return style.display !== 'none'; } }