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

Observing error 500 on MATR for the device MAC address table which is empty #192

Merged
merged 1 commit into from
Jan 10, 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
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
Loading