Skip to content

Commit

Permalink
fix: save last_ts when learning a new cluster node
Browse files Browse the repository at this point in the history
  • Loading branch information
fredriklindberg committed Sep 30, 2023
1 parent 221c3f2 commit 9b1ce88
Showing 1 changed file with 3 additions and 2 deletions.
5 changes: 3 additions & 2 deletions src/cluster/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -192,6 +192,7 @@ class ClusterService extends EventEmitter {
cnode.id = node.id;
cnode.host = node.host;
cnode.ip = node.ip;
cnode.last_ts = node.last_ts;
cnode.stale = false;

clearTimeout(cnode.staleTimer);
Expand Down Expand Up @@ -234,7 +235,7 @@ class ClusterService extends EventEmitter {
id: Node.identifier,
host: Node.hostname,
ip: Node.address,
last_ts: new Date().getTime(),
last_ts: Date.now(),
stale: false,
};
}
Expand All @@ -260,7 +261,7 @@ class ClusterService extends EventEmitter {
id: this._nodes[k].id,
host: this._nodes[k].host,
ip: this._nodes[k].ip,
last_ts: Node.identifier == this._nodes[k].id ? new Date().getTime() : this._nodes[k].last_ts,
last_ts: Node.identifier == this._nodes[k].id ? Date.now() : this._nodes[k].last_ts,
stale: this._nodes[k].stale,
}
})
Expand Down

0 comments on commit 9b1ce88

Please sign in to comment.