Skip to content

Commit

Permalink
Observing error 500 on MATR for the device MAC address table which is…
Browse files Browse the repository at this point in the history
… empty

Fixes #189
  • Loading branch information
schiavi-siae committed Jan 10, 2024
1 parent 23afb78 commit d5db4a2
Showing 1 changed file with 10 additions and 8 deletions.
18 changes: 10 additions & 8 deletions server/service/IndividualServicesService.js
Original file line number Diff line number Diff line change
Expand Up @@ -356,9 +356,9 @@ function waitAsync(ms) {
return new Promise(resolve => setTimeout(resolve, ms));
}

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


Expand Down Expand Up @@ -393,7 +393,7 @@ exports.updateCurrentConnectedEquipment = async function (user, originator, xCor
}
catch (error) {
console.error('No Equipment connected. Wait 60 seconds and retry to read...');
executeAfterWait();
executeAfterWait();
newConnectedListFromMwdi = null;
}

Expand Down Expand Up @@ -645,7 +645,7 @@ const RequestForListOfNetworkElementInterfacesOnPathCausesReadingFromElasticSear
mergedArray = mergedArray.concat(source);
}

const filteredObjects = mergedArray.filter(obj =>
const filteredObjects = mergedArray.filter(obj =>
obj['remote-mac-address'].toLowerCase() === targetMacAddress.toLowerCase()
);

Expand Down Expand Up @@ -822,7 +822,7 @@ const PromptForProvidingAllMacTablesCausesReadingFromElasticSearch = async funct

try {
let res2 = await client.search({
index: '6', // Sostituisci con il nome del tuo indice
index: '6',
_source: 'mac-address',
body: {
query: {
Expand Down Expand Up @@ -900,11 +900,13 @@ function formatTimestamp(timestamp) {
const PromptForProvidingSpecificMacTableCausesReadingFromElasticSearch = async function (body) {
return new Promise(async function (resolve, reject) {
let client = await elasticsearchService.getClient(false);
let res2;
var response = { 'application/json': [] };

try {
let mountName = body['mount-name'];

let res2 = await client.get({
res2 = await client.get({
index: '6',
id: mountName
});
Expand All @@ -923,14 +925,14 @@ const PromptForProvidingSpecificMacTableCausesReadingFromElasticSearch = async f
'mac-address': formattedEntries
};


if (Object.keys(response).length > 0) {
resolve(response['application/json']['mac-address']);
} else {
resolve(null); // Resolve the promise with null if necessary
}
} catch (error) {
reject(error);
resolve(response['application/json']);
}
});
};
Expand Down

0 comments on commit d5db4a2

Please sign in to comment.