@@ -106,8 +106,18 @@ exports.checkIn = async () => {
|
|||||||
if (!runningClientConfig?.id || runningClientConfig.id == 0) {
|
if (!runningClientConfig?.id || runningClientConfig.id == 0) {
|
||||||
// ID was not found in the config, creating a new node
|
// ID was not found in the config, creating a new node
|
||||||
reqOptions = new requestOptions("/nodes/newNode", "POST");
|
reqOptions = new requestOptions("/nodes/newNode", "POST");
|
||||||
sendHttpRequest(reqOptions, JSON.stringify(runningClientConfig), async (responseObject) => {
|
sendHttpRequest(reqOptions, JSON.stringify(runningClientConfig), async (responseObject) => {
|
||||||
// Update the client's ID if the server accepted it
|
// Check if the server responded
|
||||||
|
if (!responseObject) {
|
||||||
|
log.WARN("Server did not respond to checkIn. Will wait 60 seconds then try again");
|
||||||
|
setTimeout(() => {
|
||||||
|
// Run itself again to see if the server is up now
|
||||||
|
this.checkIn();
|
||||||
|
}, 60000);
|
||||||
|
return
|
||||||
|
}
|
||||||
|
|
||||||
|
// Update the client's ID if the server accepted its
|
||||||
if (responseObject.statusCode === 202) {
|
if (responseObject.statusCode === 202) {
|
||||||
runningClientConfig.id = responseObject.body.nodeId;
|
runningClientConfig.id = responseObject.body.nodeId;
|
||||||
log.DEBUG("Response object from new node: ", responseObject, runningClientConfig);
|
log.DEBUG("Response object from new node: ", responseObject, runningClientConfig);
|
||||||
|
|||||||
Reference in New Issue
Block a user