diff mbox series

web-app: add 120s timeout fallback for restart modal

Message ID 20260220210304.4170355-1-radian.dc@gmail.com
State Changes Requested
Headers show
Series web-app: add 120s timeout fallback for restart modal | expand

Commit Message

Adrian DC Feb. 20, 2026, 9:03 p.m. UTC
If SWUpdate is provided only per-request from a secondary system
(such as a rescue minimal Linux running of an EEPROM),
and if the update leads to a primary system without SWUpdate services,
after updating the SWUpdate page will never respond after rebooting.

Add a 120s timeout upon SWUpdate restart modal access,
normal usage remains applicable, and 2 minutes timeout clears dialog.
---

Signed-off-by: Adrian DC <radian.dc@gmail.com>
---
 web-app/js/swupdate.js | 9 ++++++++-
 1 file changed, 8 insertions(+), 1 deletion(-)
diff mbox series

Patch

diff --git a/web-app/js/swupdate.js b/web-app/js/swupdate.js
index faeca3d2..2edab597 100755
--- a/web-app/js/swupdate.js
+++ b/web-app/js/swupdate.js
@@ -29,7 +29,14 @@  function restart () {
 function showRestart () {
   const restartModal = new bootstrap.Modal('#swu-restart-modal', { backdrop: 'static', keyboard: false })
   restartModal.show()
-  window.setTimeout(tryReload, 3000)
+  window.setTimeout(tryReload, 10000)
+  window.setTimeout(fallbackRestart, 120000)
+}
+
+function fallbackRestart () {
+  if ($('#swu-restart-modal').is(':visible')) {
+    $('#swu-restart-modal').modal('hide')
+  }
 }
 
 function tryReload () {