From f3fd8875531430caad3bc90a95254611ca7a2cae Mon Sep 17 00:00:00 2001 From: Simon Rettberg Date: Fri, 13 Dec 2019 15:34:11 +0100 Subject: [rebootcontrol] Longer cooldown for client status updates --- modules-available/rebootcontrol/clientscript.js | 12 ++++++------ modules-available/rebootcontrol/templates/status-reboot.html | 2 +- modules-available/rebootcontrol/templates/status-wol.html | 2 +- 3 files changed, 8 insertions(+), 8 deletions(-) (limited to 'modules-available') diff --git a/modules-available/rebootcontrol/clientscript.js b/modules-available/rebootcontrol/clientscript.js index 80be2533..447072a0 100644 --- a/modules-available/rebootcontrol/clientscript.js +++ b/modules-available/rebootcontrol/clientscript.js @@ -1,13 +1,13 @@ -var stillActive = true; +var stillActive = 10; document.addEventListener('DOMContentLoaded', function() { var clients = []; $('.machineuuid').each(function() { clients.push($(this).data('uuid')); }); if (clients.length === 0) return; function updateClientStatus() { - if (!stillActive) return; - stillActive = false; - setTimeout(updateClientStatus, 5000); + if (stillActive <= 0) return; + stillActive--; + setTimeout(updateClientStatus, Math.max(1, 30 - stillActive) * 1000); $.ajax({ url: "?do=rebootcontrol", method: "POST", @@ -19,9 +19,9 @@ document.addEventListener('DOMContentLoaded', function() { return; for (var e in data) { $('#status-' + e).prop('class', 'glyphicon ' + data[e]); - if (!stillActive) $('#spinner-' + e).remove(); + if (stillActive <= 0) $('#spinner-' + e).remove(); } }); } - setTimeout(updateClientStatus, 1000); + setTimeout(updateClientStatus, 10); }); \ No newline at end of file diff --git a/modules-available/rebootcontrol/templates/status-reboot.html b/modules-available/rebootcontrol/templates/status-reboot.html index 240c4387..7b46cab4 100644 --- a/modules-available/rebootcontrol/templates/status-reboot.html +++ b/modules-available/rebootcontrol/templates/status-reboot.html @@ -46,7 +46,7 @@ function updateStatus(task) { if (!task || !task.data || !task.data.clientStatus) return; - stillActive = true; + stillActive = 25; var clientStatus = task.data.clientStatus; for (var uuid in clientStatus) { if (!clientStatus.hasOwnProperty(uuid)) diff --git a/modules-available/rebootcontrol/templates/status-wol.html b/modules-available/rebootcontrol/templates/status-wol.html index 3e83126c..0e91e8d8 100644 --- a/modules-available/rebootcontrol/templates/status-wol.html +++ b/modules-available/rebootcontrol/templates/status-wol.html @@ -47,6 +47,6 @@ \ No newline at end of file -- cgit v1.2.3-55-g7522