Skip to content

Commit

Permalink
Debug settings + commented out 'keep active' logic
Browse files Browse the repository at this point in the history
  • Loading branch information
Aaron Caldwell committed Nov 30, 2020
1 parent 3d02d87 commit 09e61e1
Show file tree
Hide file tree
Showing 2 changed files with 20 additions and 15 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -191,12 +191,18 @@ export async function executeEsQueryFactory(
},
};


console.log('************************');
console.log(JSON.stringify(esQuery.body));

let esResult: SearchResponse<unknown> | undefined;
try {
esResult = await callCluster('search', esQuery);
} catch (err) {
log.warn(`${err.message}`);
}
console.log('_______________________');
console.log(JSON.stringify(esResult));
return esResult;
};
}
Original file line number Diff line number Diff line change
Expand Up @@ -165,23 +165,22 @@ export const getGeoContainmentExecutor = (log: Logger) =>
);

// Cycle through instances that received no updates and keep active
const activeAlertsList = state.activeAlertsList || {};

_.forEach(activeAlertsList, (val, key) => {
if (!currLocationMap.has(key)) {
const containingBoundaryName =
shapesIdsNamesMap[val.containingBoundaryId] || val.containingBoundaryId;
const alertInstanceId = `${val.entityName}-${containingBoundaryName}`;
services.alertInstanceFactory(alertInstanceId).scheduleActions(ActionGroupId, val);
}
});

// const activeAlertsList = state.activeAlertsList || {};
// _.forEach(activeAlertsList, (val, key) => {
// if (!currLocationMap.has(key)) {
// const containingBoundaryName =
// shapesIdsNamesMap[val.containingBoundaryId] || val.containingBoundaryId;
// const alertInstanceId = `${key}-${containingBoundaryName}`;
// services.alertInstanceFactory(alertInstanceId).scheduleActions(ActionGroupId, val);
// }
// });
//
// Cycle through new alert statuses and set active
currLocationMap.forEach(({ location, shapeLocationId, dateInShape, docId }, entityName) => {
const containingBoundaryName = shapesIdsNamesMap[shapeLocationId] || shapeLocationId;
const context = {
entityId: entityName,
entityDateTime: new Date(dateInShape).getTime(),
entityDateTime: dateInShape,
entityDocumentId: docId,
detectionDateTime: new Date(currIntervalEndTime).getTime(),
entityLocation: `POINT (${location[0]} ${location[1]})`,
Expand All @@ -190,15 +189,15 @@ export const getGeoContainmentExecutor = (log: Logger) =>
};
const alertInstanceId = `${entityName}-${containingBoundaryName}`;
if (shapeLocationId !== OTHER_CATEGORY) {
activeAlertsList[entityName] = context;
// activeAlertsList[entityName] = context;
services.alertInstanceFactory(alertInstanceId).scheduleActions(ActionGroupId, context);
} else {
delete activeAlertsList[entityName];
// delete activeAlertsList[entityName];
}
});

return {
activeAlertsList,
// activeAlertsList,
shapesFilters,
shapesIdsNamesMap,
};
Expand Down

0 comments on commit 09e61e1

Please sign in to comment.