Implement Node Monitor Service
- Check in with online nodes every n ms - Update nodes that do not reply - Added node object record helper - Updated mysql wrapper for updating node info to accept bool or number
This commit is contained in:
@@ -68,6 +68,7 @@ exports.addNewNode = (nodeObject, callback) => {
|
||||
* @param callback Callback function
|
||||
*/
|
||||
exports.updateNodeInfo = (nodeObject, callback) => {
|
||||
if(!nodeObject.id) throw new Error("Attempted to updated node without providing ID", nodeObject);
|
||||
const name = nodeObject.name,
|
||||
ip = nodeObject.ip,
|
||||
port = nodeObject.port,
|
||||
@@ -84,8 +85,8 @@ exports.updateNodeInfo = (nodeObject, callback) => {
|
||||
nearbySystems = utils.JsonToBuffer(nearbySystems)
|
||||
queryParams.push(`nearbySystems = '${nearbySystems}'`);
|
||||
}
|
||||
if (typeof online === "boolean") {
|
||||
if (online) queryParams.push(`online = 1`);
|
||||
if (typeof online === "boolean" || typeof online === "number") {
|
||||
if (online || online === 1) queryParams.push(`online = 1`);
|
||||
else queryParams.push(`online = 0`);
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user