-
Notifications
You must be signed in to change notification settings - Fork 7
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Deprecate monitor.sh #53
Conversation
…o logs instead of memcache
Wow! I am extremely excited to look at this. Thanks @haydenhw ! |
src/app.js
Outdated
// If an exitnode has not checked in in the last two minutes, report an error message | ||
const getExitnodeStats = function (exitnodeIP) { | ||
return db.collection('routeLog') | ||
.aggregate([ |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Is an aggregation necessary here? I'm wondering if it would be simpler to fetch the most recent entry in the log for an exitnodeIP, and then count the number of nodes/gateways outside of mongo-land.
src/app.js
Outdated
@@ -56,11 +56,44 @@ function MonitorApp ({ | |||
} | |||
|
|||
async function getMonitorUpdates() { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Might as well make this function name more specific while we're here. Could be something like your inner helper function -- latestExitnodeStats()
. Or numNodesLastSeenAtExitnodes()
.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I ended up renaming this to countActiveRoutesByExitnode(). Let me know if you like one of these other names better. Happy to change it to whatever
mjs.set(key, JSON.stringify(processed), {expires: 120}, handleErr); | ||
} | ||
}); | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yessssssssssss :-)
}) | ||
}) | ||
} | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yessssssssssss.
}); | ||
}); | ||
|
||
}); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yesssssssssssss
…name getMonitorUpdates -> countActiveRoutesByExitnodes refactor getMonitorUpdates; rename to countActiveRoutesByExitnodes
Rad! |
For #42