Ensure async functions wait for node contstructor
This commit is contained in:
@@ -92,7 +92,7 @@ exports.getAllNodesSync = async () => {
|
|||||||
|
|
||||||
console.log("Rows: ", rows);
|
console.log("Rows: ", rows);
|
||||||
|
|
||||||
return returnNodeObjectFromRows(rows);
|
return await returnNodeObjectFromRows(rows);
|
||||||
}
|
}
|
||||||
|
|
||||||
/** Get all nodes that have the online status set true (are online)
|
/** Get all nodes that have the online status set true (are online)
|
||||||
@@ -122,7 +122,7 @@ exports.getOnlineNodes = (callback) => {
|
|||||||
|
|
||||||
// Call back the first (and theoretically only) row
|
// Call back the first (and theoretically only) row
|
||||||
// Specify 0 so downstream functions don't have to worry about it
|
// Specify 0 so downstream functions don't have to worry about it
|
||||||
return (callback) ? callback(returnNodeObjectFromRow(sqlResponse[0])) : returnNodeObjectFromRow(sqlResponse[0]);
|
return (callback) ? callback(await returnNodeObjectFromRow(sqlResponse[0])) : await returnNodeObjectFromRow(sqlResponse[0]);
|
||||||
}
|
}
|
||||||
exports.getNodeInfoFromId = getNodeInfoFromId
|
exports.getNodeInfoFromId = getNodeInfoFromId
|
||||||
|
|
||||||
@@ -207,7 +207,7 @@ exports.updateNodeInfo = async (nodeObject, callback = undefined) => {
|
|||||||
});
|
});
|
||||||
|
|
||||||
if (sqlResponse.affectedRows === 1) return (callback) ? callback(true) : true;
|
if (sqlResponse.affectedRows === 1) return (callback) ? callback(true) : true;
|
||||||
else return (callback) ? callback(returnNodeObjectFromRows(sqlResponse)) : returnNodeObjectFromRows(sqlResponse);
|
else return (callback) ? callback(await returnNodeObjectFromRows(sqlResponse)) : await returnNodeObjectFromRows(sqlResponse);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|||||||
Reference in New Issue
Block a user