# HG changeset patch # User Drew Perttula # Date 2019-06-06 10:02:19 # Node ID e0dd7fa987ea64eb9cfda85ac0df1f5de00212e5 # Parent a745bee5c4191f674cbb29d28e22ab4f1528c24d stats: retry downed servers so their stats wake up when they do Ignore-this: dbb695fd829292af2450065603cd8d7e diff --git a/light9/web/index.html b/light9/web/index.html --- a/light9/web/index.html +++ b/light9/web/index.html @@ -8,10 +8,8 @@ - - - - + + @@ -78,7 +71,7 @@

- +
@@ -88,9 +81,10 @@ -
+ diff --git a/light9/web/stats-line.js b/light9/web/stats-line.js --- a/light9/web/stats-line.js +++ b/light9/web/stats-line.js @@ -23,7 +23,14 @@ class StatsLine extends LitElement { resp.json().then((msg) => { this.stats = msg; setTimeout(reload, 1000); + }).catch((err) => { + setTimeout(reload, 1000); }); + } else { + if (resp.status == 502) { + setTimeout(reload, 5000); + } + // 404: likely not mapped to a responding server } }); } diff --git a/light9/web/stats-process.js b/light9/web/stats-process.js --- a/light9/web/stats-process.js +++ b/light9/web/stats-process.js @@ -37,7 +37,7 @@ class StatsProcess extends LitElement { // wrong type of fade- never goes to 0 ctx.fillStyle = '#00000003'; ctx.fillRect(0, 0, w, h); - if (this.data.time < now - 2) { + if (!this.data || this.data.time < now - 2) { return; } const dt = now - prev;