Persist right after loading dump
parent
84533dc9ef
commit
bb4935641a
|
@ -373,7 +373,7 @@ class AntiCluster
|
||||||
}
|
}
|
||||||
else if (msg.load)
|
else if (msg.load)
|
||||||
{
|
{
|
||||||
this._handleLoadMsg(client, msg);
|
this._handleLoadMsg(client, msg).catch(console.error);
|
||||||
}
|
}
|
||||||
else if (msg.replicate)
|
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 &&
|
if (client.raft_node_id && this.raft.state == TinyRaft.FOLLOWER &&
|
||||||
this.raft.leader === client.raft_node_id && this.raft.term == msg.term)
|
this.raft.leader === client.raft_node_id && this.raft.term == msg.term)
|
||||||
{
|
{
|
||||||
this.antietcd.etctree.load(msg.load);
|
this.antietcd.etctree.load(msg.load);
|
||||||
|
if (this.antietcd.persistence)
|
||||||
|
{
|
||||||
|
await this.antietcd.persistence.persist();
|
||||||
|
}
|
||||||
this.antietcd.stored_term = msg.term;
|
this.antietcd.stored_term = msg.term;
|
||||||
this.synced = true;
|
this.synced = true;
|
||||||
runCallbacks(this, 'wait_sync', []);
|
runCallbacks(this, 'wait_sync', []);
|
||||||
|
|
Loading…
Reference in New Issue