Enabled nodeMonitorService

- Updated logging for nodeMonitorService to use it's own debugBuilder
This commit is contained in:
Logan Cusano
2023-06-18 14:56:54 -04:00
parent 24faa5279d
commit 5d54f07af4
2 changed files with 9 additions and 8 deletions

View File

@@ -108,6 +108,7 @@ exports.requestNodeJoinServer = async (req, res) => {
*/
exports.nodeMonitorService = class nodeMonitorService {
constructor() {
this.log = new DebugBuilder("server", "nodeMonitorService");
}
async start(){
@@ -130,21 +131,21 @@ exports.nodeMonitorService = class nodeMonitorService {
async checkInWithOnlineNodes(){
getOnlineNodes((nodes) => {
log.DEBUG("Online Nodes: ", nodes);
this.log.DEBUG("Online Nodes: ", nodes);
for (const node of nodes) {
const reqOptions = new requestOptions("/client/requestCheckIn", "GET", node.ip, node.port)
const request = sendHttpRequest(reqOptions, "", (responseObj) => {
sendHttpRequest(reqOptions, "", (responseObj) => {
if (responseObj) {
log.DEBUG("Response from: ", node.name, responseObj);
this.log.DEBUG("Response from: ", node.name, responseObj);
}
else {
log.DEBUG("No response from node, assuming it's offline");
this.log.DEBUG("No response from node, assuming it's offline");
const offlineNode = new nodeObject({ _online: 0, _id: node.id });
log.DEBUG("Offline node update object: ", offlineNode);
this.log.DEBUG("Offline node update object: ", offlineNode);
updateNodeInfo(offlineNode, (sqlResponse) => {
if (!sqlResponse) log.ERROR("No response from SQL object");
if (!sqlResponse) this.log.ERROR("No response from SQL object");
log.DEBUG("Updated node: ", sqlResponse);
this.log.DEBUG("Updated offline node: ", sqlResponse);
})
}
})

View File

@@ -148,7 +148,7 @@ client.on('ready', () => {
runHTTPServer();
log.DEBUG("Starting Node Monitoring Service");
//runNodeMonitorService();
runNodeMonitorService();
log.DEBUG("Starting RSS watcher");
runRssService();