Skip to content

Commit

Permalink
change dev
Browse files Browse the repository at this point in the history
  • Loading branch information
icebob committed Feb 9, 2018
1 parent 4e34dc7 commit f1f1799
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 2 deletions.
2 changes: 1 addition & 1 deletion .vscode/launch.json
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@
"program": "${workspaceRoot}/dev/index.js",
"cwd": "${workspaceRoot}",
"args": [
"client"
"gossip-viz"
]
},
{
Expand Down
13 changes: 12 additions & 1 deletion dev/gossip-viz.js
Original file line number Diff line number Diff line change
Expand Up @@ -100,6 +100,14 @@ function printStatuses() {
console.log("Time: " + _.padStart(duration, 5), "sec Coverage:", _.padStart(sCov, 13));
}

function getMaxSeq(nodeID) {
return brokers.reduce((seq, { broker }) => {
if (!broker) return seq;
let n = broker.registry.nodes.toArray().find(n => n.id == nodeID);
return (n && n.seq && n.seq > seq) ? n.seq : seq;
}, 0);
}

function printBrokerStatus({ nodeID, broker }) {
let count = 0;
let s = _.padEnd(broker ? chalk.green(nodeID) : chalk.red(nodeID), 20);
Expand All @@ -113,7 +121,10 @@ function printBrokerStatus({ nodeID, broker }) {

const node = list.find(node => node.id == search);
if (node && node.available) {
s += chalk.green.bold("█");
//if (node.seq == getMaxSeq(node.id))
s += chalk.green.bold("█");
//else
// s += chalk.yellow.bold("█");
count++;
} else {
s += chalk.red.bold("█");
Expand Down

0 comments on commit f1f1799

Please sign in to comment.