in source/backend/discovery/src/discovery/discovery-service.js [109:133]
async getResource(resourceId, resourceType, accountId, region, depth, extrasToStore) {
let resource = this.visitedMap.get(resourceId);
if (resource === undefined) {
// As code is running in promises so need to close off the posibility of two promises scanning the same resource. Hence adding an inProgress to the visited map.
this.visitedMap.set(resourceId, "inProgress");
// When discovery first starts it gets an ICL (Intial Client Load) from neptune of all existing resources.
let icl = this.dataClient.resourceIdIndex.get(resourceId);
let recentlyUpdated = this.dataClient.updatedResources.get(resourceId);
if (advancedQueryUnsupported.includes(resourceType) || (icl && recentlyUpdated) || (!icl)) {
return await this.getDataFromConfig(resourceId, resourceType, accountId, region, depth, extrasToStore);
}
else if (resource === "inProgress") {
logger.info("Another process is scanning " + resourceId);
return;
}
else if (icl) {
return await this.getDataFromICL(icl, resourceId, accountId, region, depth, extrasToStore);
}
}
else {
return resource;
}
}