Skip to content

Commit

Permalink
refactor(validator): change getter to method
Browse files Browse the repository at this point in the history
The getter that was changed: isCurrentNodeLeader
  • Loading branch information
petermetz committed Nov 19, 2019
1 parent 23d26e6 commit 4bda8ca
Showing 1 changed file with 4 additions and 4 deletions.
8 changes: 4 additions & 4 deletions src/Validator.js
Original file line number Diff line number Diff line change
Expand Up @@ -84,7 +84,7 @@ class Validator {
this.setupLeaderElections();
}

get isCurrentNodeLeader() {
isCurrentNodeLeader() {
return typeof this.leaderNodeInfo === 'object' && this.leaderNodeInfo.id === this.selfNodeInfo.id;
}

Expand Down Expand Up @@ -133,7 +133,7 @@ class Validator {
}

attemptToBecomeLeader(theLease) {
if (this.isCurrentNodeLeader) {
if (this.isCurrentNodeLeader()) {
return;
}
this.etcdClient
Expand All @@ -160,7 +160,7 @@ class Validator {
* @return {void}
*/
stop() {
if (this.isCurrentNodeLeader) {
if (this.isCurrentNodeLeader()) {
clearInterval(this.intervalExec);
this.requestSocket.close();
}
Expand Down Expand Up @@ -313,7 +313,7 @@ class Validator {
this.requestSocket = null;
}

if (this.isCurrentNodeLeader) {
if (this.isCurrentNodeLeader()) {
this.startAsLeader();
} else {
this.startAsFollower();
Expand Down

0 comments on commit 4bda8ca

Please sign in to comment.