more consistent variables

master
Bel LaPointe 2021-02-26 23:08:05 -06:00
parent da08be0285
commit efed1ce04f
1 changed files with 8 additions and 9 deletions

View File

@ -1304,11 +1304,10 @@
sync() sync()
{ {
console.log("syncing to replicas: " + this.pendingSyncCount()); console.log("syncing to replicas: " + this.pendingSyncCount());
this.deltas.popEach((k) => { this.deltas.popEach((key) => {
console.log("syncing to replicas: " + k); console.log("syncing to replicas: " + key);
this.replicate(k); this.replicate(key);
}); });
console.log("synced to replicas: " + this.pendingSyncCount());
this.writePendingSyncCount(); this.writePendingSyncCount();
} }
@ -1326,14 +1325,14 @@
document.getElementById("pending").innerHTML = s; document.getElementById("pending").innerHTML = s;
} }
replicate(k) replicate(key)
{ {
var v = this.primary().get(k); var value = this.primary().get(key);
this.replicas().forEach((database) => { this.replicas().forEach((database) => {
if (v) if (value)
database.set(k, v); database.set(key, value);
else else
database.del(k, v); database.del(key, value);
}); });
} }