Skip to content

Commit

Permalink
fix: set leader status to none if not picked yet
Browse files Browse the repository at this point in the history
  • Loading branch information
mKeRix committed May 2, 2020
1 parent 6e097f7 commit 8025011
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 2 deletions.
2 changes: 1 addition & 1 deletion src/status/status.service.ts
Expand Up @@ -46,7 +46,7 @@ export class StatusService implements OnApplicationBootstrap {
* Updates the cluster leader sensor based on the currently elected leader.
*/
updateClusterLeaderSensor(): void {
this.clusterLeaderSensor.state = this.clusterService.leader().id;
this.clusterLeaderSensor.state = this.clusterService.leader()?.id || 'none';
this.clusterLeaderSensor.attributes.quorumReached = this.clusterService.quorumReached();
}

Expand Down
2 changes: 1 addition & 1 deletion typings/democracy/index.d.ts
Expand Up @@ -15,7 +15,7 @@ declare module 'democracy' {
protected checkBallots(candidate: string): this;
hello(): this;
nodes(): { [key: string]: Node };
leader(): Node;
leader(): Node | undefined;
resign(): this;
isLeader(): boolean;
send(customEvent: string, extraData?: any, id?: string): this;
Expand Down

0 comments on commit 8025011

Please sign in to comment.