From 326d6a60a41e52b202173280462a225e1abc5df0 Mon Sep 17 00:00:00 2001 From: Bel LaPointe Date: Fri, 26 Feb 2021 23:17:53 -0600 Subject: [PATCH] Create dummy bomber database, no alert on background sync fail --- nullboard.html | 47 +++++++++++++++++++++++++++++++++++++++-------- 1 file changed, 39 insertions(+), 8 deletions(-) diff --git a/nullboard.html b/nullboard.html index 13fbe7b..68a14a8 100644 --- a/nullboard.html +++ b/nullboard.html @@ -1303,12 +1303,22 @@ sync() { - console.log("syncing to replicas: " + this.pendingSyncCount()); - this.deltas.popEach((key) => { - console.log("syncing to replicas: " + key); - this.replicate(key); - }); - this.writePendingSyncCount(); + var n = this.pendingSyncCount(); + try + { + this.deltas.popEach((key) => { + console.log("syncing to replicas: " + key); + this.replicate(key); + }); + } + catch (e) + { + console.log("failed to sync: " + e); + } + finally + { + this.writePendingSyncCount(); + } } pendingSyncCount() @@ -1319,7 +1329,7 @@ writePendingSyncCount() { var n = this.pendingSyncCount(); - var s = "(" + n + ")"; + var s = "(" + n + " items pending replication)"; if (! n) s = "" document.getElementById("pending").innerHTML = s; @@ -1429,6 +1439,27 @@ } } + class Bomber extends Database { + get(key) { + throw "teehee"; + } + + set(key, value) + { + throw "teehee"; + } + + del(key) + { + throw "teehee"; + } + + forEach(foo) + { + throw "teehee"; + } + } + class Local extends Database { constructor() { @@ -1467,10 +1498,10 @@ } } - globalStorage = new NamespacedDatabase("4", new Local()); globalStorage = new MultiDatabase( new NamespacedDatabase("A", new Local()), new NamespacedDatabase("B", new Local()), + //new Bomber(), ); /*