Skip to content

Commit

Permalink
fix bug on findmaster
Browse files Browse the repository at this point in the history
  • Loading branch information
alihm committed Jun 5, 2024
1 parent ad7b077 commit 4f8f0a8
Showing 1 changed file with 12 additions and 12 deletions.
24 changes: 12 additions & 12 deletions ClusterOperator/Operator.js
Original file line number Diff line number Diff line change
Expand Up @@ -693,20 +693,20 @@ class Operator {
log.info(`masterCandidates: ${JSON.stringify(this.masterCandidates)}`);
// if first candidate is me i'm the master
if (this.masterCandidates[0] === this.myIP) {
let MasterIP = this.myIP;
// let MasterIP = this.myIP;
// ask second candidate for confirmation
if (this.masterCandidates.length > 1) MasterIP = await fluxAPI.getMaster(this.masterCandidates[1], config.containerApiPort);
// if (this.masterCandidates.length > 1) MasterIP = await fluxAPI.getMaster(this.masterCandidates[1], config.containerApiPort);

if (MasterIP === this.myIP) {
this.IamMaster = true;
this.masterNode = this.myIP;
this.status = 'OK';
} else if (MasterIP === null || MasterIP === 'null') {
log.info('retrying FindMaster...');
return this.findMaster();
} else {
this.masterNode = MasterIP;
}
// if (MasterIP === this.myIP) {
this.IamMaster = true;
this.masterNode = this.myIP;
this.status = 'OK';
// } else if (MasterIP === null || MasterIP === 'null') {
// log.info('retrying FindMaster...');
// return this.findMaster();
// } else {
// this.masterNode = MasterIP;
// }
} else {
// ask first candidate who the master is
log.info(`asking master from ${this.masterCandidates[0]}`);
Expand Down

0 comments on commit 4f8f0a8

Please sign in to comment.