Fix "leadership expiration"

de64
Vitaliy Filippov 2023-07-06 20:16:58 +03:00
parent 7aef34f5bf
commit a6893ea494
1 changed files with 4 additions and 1 deletions

View File

@ -194,11 +194,14 @@ class TinyRaft extends EventEmitter
}
else if (msg.type == PONG && this.state == LEADER)
{
this._nextTerm(-1);
if (msg.leader != this.nodeId)
{
this.start();
}
else
{
this._nextTerm(this.leadershipTimeout > 0 ? this.leadershipTimeout : -1);
}
}
}