Skip to content
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

If the list of devices is empty, wait a certain amount of time before asking again. #191

Merged
merged 1 commit into from
Jan 9, 2024
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
13 changes: 12 additions & 1 deletion server/service/IndividualServicesService.js
Original file line number Diff line number Diff line change
Expand Up @@ -352,6 +352,16 @@ function areEqualArray(listJsonES, listJsonMD) {
return true;
}

function waitAsync(ms) {
return new Promise(resolve => setTimeout(resolve, ms));
}

async function executeAfterWait() {
// Wait 60 seconds
await waitAsync(60000);
}


exports.updateCurrentConnectedEquipment = async function (user, originator, xCorrelator, traceIndicator, customerJourney) {
let result;
let listDisconnectedEq = [];
Expand Down Expand Up @@ -382,7 +392,8 @@ exports.updateCurrentConnectedEquipment = async function (user, originator, xCor
newConnectedListFromMwdi = await EmbeddingCausesRequestForListOfDevicesAtMwdi(user, originator, xCorrelator, traceIndicator, customerJourney);
}
catch (error) {
console.error('No Equipment connected. Retry to read...');
console.error('No Equipment connected. Wait 60 seconds and retry to read...');
executeAfterWait();
newConnectedListFromMwdi = null;
}

Expand Down
Loading