From bb4935641a9ea070ddc6e5f6ebfddbdb7d3faf90 Mon Sep 17 00:00:00 2001 From: Vitaliy Filippov Date: Thu, 9 May 2024 18:29:14 +0300 Subject: [PATCH] Persist right after loading dump --- anticluster.js | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/anticluster.js b/anticluster.js index 74e10ff..097b306 100644 --- a/anticluster.js +++ b/anticluster.js @@ -373,7 +373,7 @@ class AntiCluster } else if (msg.load) { - this._handleLoadMsg(client, msg); + this._handleLoadMsg(client, msg).catch(console.error); } else if (msg.replicate) { @@ -419,12 +419,16 @@ class AntiCluster } } - _handleLoadMsg(client, msg) + async _handleLoadMsg(client, msg) { if (client.raft_node_id && this.raft.state == TinyRaft.FOLLOWER && this.raft.leader === client.raft_node_id && this.raft.term == msg.term) { this.antietcd.etctree.load(msg.load); + if (this.antietcd.persistence) + { + await this.antietcd.persistence.persist(); + } this.antietcd.stored_term = msg.term; this.synced = true; runCallbacks(this, 'wait_sync', []);