From 1d9c13640db173aaa5867e22398426594f04d85e Mon Sep 17 00:00:00 2001 From: Bel LaPointe Date: Sat, 27 Feb 2021 13:58:30 -0600 Subject: [PATCH] Better namespacing multidatabase --- nullboard.html | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/nullboard.html b/nullboard.html index 58e89b5..6be35c6 100644 --- a/nullboard.html +++ b/nullboard.html @@ -1283,8 +1283,7 @@ { this.databases.push(arguments[i]); } - this.deltas = new Deltas(this.primary()); - this.cachedb = new NamespacedDatabase("cache", new Local()), + this.deltas = new Deltas(this.cache()); this.scheduleSync(); this.syncCacheWithPrimary(); } @@ -1310,7 +1309,9 @@ cache() { - return this.cachedb; + if (this.databases.length > 1) + return this.databases[1]; + return this.primary(); } primary() @@ -1320,7 +1321,7 @@ replicas() { - return [this.cache()].concat(this.databases.slice(1)); + return this.databases.slice(1); } scheduleSync()