From e63a11dcd7f349077f09cac5012e52ec271516e9 Mon Sep 17 00:00:00 2001 From: Malfurious Date: Sat, 18 Nov 2023 06:50:12 -0500 Subject: dmt: jobs: Invert default refresh time Whenever we encounter an exception (which is usually due to a network problem), default to the active refresh time as to recover from the situation as soon as possible. Eg: Only wait the full idle time when the server successfully reports it is idle. There isn't even a real concern here of request load on the server, since we can't reach the server in this condition anyway. Signed-off-by: Malfurious --- dmt/script.js | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/dmt/script.js b/dmt/script.js index e6b7b52..bc9554c 100644 --- a/dmt/script.js +++ b/dmt/script.js @@ -102,14 +102,14 @@ async function update_jobs() { let no_jobs = document.getElementById("no_jobs"); let list = document.getElementById("list"); - let timeout = %($CYCHE_IDLE_UPDATE%); + let timeout = %($CYCHE_ACTIVE_UPDATE%); try { let status = await api("/api/status"); if (version === null) { version = status.version; } if (version != status.version) { location.reload(); } - if (status.active) { timeout = %($CYCHE_ACTIVE_UPDATE%); } + if (!status.active) { timeout = %($CYCHE_IDLE_UPDATE%); } set_progress(nav_progress, (status.active ? null : "")); for (let i = status.oldest; i <= status.newest; i++) { -- cgit v1.2.3