Skip to content

Commit

Permalink
Merge pull request #1 from David-DT/fix/changed-json-format
Browse files Browse the repository at this point in the history
Fix/changed json format
  • Loading branch information
Tuditi authored Feb 9, 2021
2 parents 131255e + 89dd6ab commit 823fd6d
Showing 1 changed file with 2 additions and 14 deletions.
16 changes: 2 additions & 14 deletions app.js
Original file line number Diff line number Diff line change
Expand Up @@ -43,17 +43,12 @@ const report = (crawler) => {
nodeStats[node.ip] = {
ip: node.ip,
location: node.location,
version: node.version,
version: node.config.version,
height: node.height
}
}
}

const allDelays = nodes.filter(item => item.latency).map(item => item.latency)
const averageDelay = (allDelays.reduce((a, b) => a + b, 0) / allDelays.length).toFixed(2)
const maxDelay = Math.max(...allDelays)
const minDelay = Math.min(...allDelays)

// Node stats;
console.log('Individual node stats');
for (const node of orderBy(Object.values(nodeStats),['ip'],['desc'])) {
Expand Down Expand Up @@ -88,14 +83,7 @@ const report = (crawler) => {
for (const stat of orderBy(Object.values(versionStats), ['version'], ['desc'])) {
console.log(` - ${stat.version} on ${stat.count} nodes`)
}

// delay stats
console.log('')
console.log('Delay')
console.log(` Avg: ${averageDelay}ms`)
console.log(` Min: ${minDelay}ms`)
console.log(` Max: ${maxDelay}ms`)


console.log('------------------------------------------')
console.log(`Finished scanning in ${new Date() - crawler.startTime}ms`)

Expand Down

0 comments on commit 823fd6d

Please sign in to comment.