From fa409a533ebcffc76963da657be7eb1a7b509e1e Mon Sep 17 00:00:00 2001 From: Carl Downing Date: Sun, 30 Jul 2023 14:06:20 -0700 Subject: [PATCH] Dictonary --- ProbeAPI/Service/ProbeMonitorResponse.ts | 22 +++++++++++----------- Workers/Index.ts | 4 ++-- Workers/Utils/Cron.ts | 4 ++-- Workers/Utils/JobDictionary.ts | 2 +- 4 files changed, 16 insertions(+), 16 deletions(-) diff --git a/ProbeAPI/Service/ProbeMonitorResponse.ts b/ProbeAPI/Service/ProbeMonitorResponse.ts index 3bf5fc5546..dcc31bd88f 100644 --- a/ProbeAPI/Service/ProbeMonitorResponse.ts +++ b/ProbeAPI/Service/ProbeMonitorResponse.ts @@ -128,7 +128,7 @@ export default class ProbeMonitorResponseService { }) .flat(); - const autoResolveCriteriaInstanceIdIncidentIdsDictonary: Dictionary< + const autoResolveCriteriaInstanceIdIncidentIdsDictionary: Dictionary< Array > = {}; const criteriaInstanceMap: Dictionary = {}; @@ -144,16 +144,16 @@ export default class ProbeMonitorResponseService { .incidents) { if (incidentTemplate.autoResolveIncident) { if ( - !autoResolveCriteriaInstanceIdIncidentIdsDictonary[ + !autoResolveCriteriaInstanceIdIncidentIdsDictionary[ criteriaInstance.data.id.toString() ] ) { - autoResolveCriteriaInstanceIdIncidentIdsDictonary[ + autoResolveCriteriaInstanceIdIncidentIdsDictionary[ criteriaInstance.data.id.toString() ] = []; } - autoResolveCriteriaInstanceIdIncidentIdsDictonary[ + autoResolveCriteriaInstanceIdIncidentIdsDictionary[ criteriaInstance.data.id.toString() ]?.push(incidentTemplate.id); } @@ -207,7 +207,7 @@ export default class ProbeMonitorResponseService { monitor: monitor, rootCause: response.rootCause, probeMonitorResponse: probeMonitorResponse, - autoResolveCriteriaInstanceIdIncidentIdsDictonary, + autoResolveCriteriaInstanceIdIncidentIdsDictionary, criteriaInstance: criteriaInstanceMap[response.criteriaMetId!]!, }); } else if ( @@ -244,7 +244,7 @@ export default class ProbeMonitorResponseService { monitor: Monitor; probeMonitorResponse: ProbeMonitorResponse; rootCause: string; - autoResolveCriteriaInstanceIdIncidentIdsDictonary: Dictionary< + autoResolveCriteriaInstanceIdIncidentIdsDictionary: Dictionary< Array >; }): Promise { @@ -310,8 +310,8 @@ export default class ProbeMonitorResponseService { const shouldClose: boolean = ProbeMonitorResponseService.shouldCloseIncident({ openIncident, - autoResolveCriteriaInstanceIdIncidentIdsDictonary: - input.autoResolveCriteriaInstanceIdIncidentIdsDictonary, + autoResolveCriteriaInstanceIdIncidentIdsDictionary: + input.autoResolveCriteriaInstanceIdIncidentIdsDictionary, criteriaInstance: input.criteriaInstance, }); @@ -453,7 +453,7 @@ export default class ProbeMonitorResponseService { private static shouldCloseIncident(input: { openIncident: Incident; - autoResolveCriteriaInstanceIdIncidentIdsDictonary: Dictionary< + autoResolveCriteriaInstanceIdIncidentIdsDictionary: Dictionary< Array >; criteriaInstance: MonitorCriteriaInstance; @@ -477,12 +477,12 @@ export default class ProbeMonitorResponseService { } if ( - input.autoResolveCriteriaInstanceIdIncidentIdsDictonary[ + input.autoResolveCriteriaInstanceIdIncidentIdsDictionary[ input.openIncident.createdCriteriaId?.toString() ] ) { if ( - input.autoResolveCriteriaInstanceIdIncidentIdsDictonary[ + input.autoResolveCriteriaInstanceIdIncidentIdsDictionary[ input.openIncident.createdCriteriaId?.toString() ]?.includes( input.openIncident.createdIncidentTemplateId?.toString() diff --git a/Workers/Index.ts b/Workers/Index.ts index 91a6111597..7542218718 100644 --- a/Workers/Index.ts +++ b/Workers/Index.ts @@ -36,7 +36,7 @@ import StatusPageCerts from './Jobs/StatusPageCerts/StatusPageCerts'; // Express import Express, { ExpressApplication } from 'CommonServer/Utils/Express'; -import JobDictonary from './Utils/JobDictionary'; +import JobDictionary from './Utils/JobDictionary'; // Monitor Owners import './Jobs/MonitorOwners/SendCreatedResourceNotification'; @@ -98,7 +98,7 @@ const init: Function = async (): Promise => { logger.info('Running Job: ' + name); - const funcToRun: Function = JobDictonary.getJobFunction(name); + const funcToRun: Function = JobDictionary.getJobFunction(name); if (funcToRun) { await funcToRun(); diff --git a/Workers/Utils/Cron.ts b/Workers/Utils/Cron.ts index d527bfcad0..49f1eb6081 100644 --- a/Workers/Utils/Cron.ts +++ b/Workers/Utils/Cron.ts @@ -1,4 +1,4 @@ -import JobDictonary from './JobDictionary'; +import JobDictionary from './JobDictionary'; import Queue, { QueueName } from 'CommonServer/Infrastructure/Queue'; import logger from 'CommonServer/Utils/Logger'; @@ -10,7 +10,7 @@ const RunCron: Function = ( }, runFunction: Function ): void => { - JobDictonary.setJobFunction(jobName, runFunction); + JobDictionary.setJobFunction(jobName, runFunction); logger.info('Adding job to the queue: ' + jobName); diff --git a/Workers/Utils/JobDictionary.ts b/Workers/Utils/JobDictionary.ts index 3ad6faa879..c9ecd4ea39 100644 --- a/Workers/Utils/JobDictionary.ts +++ b/Workers/Utils/JobDictionary.ts @@ -1,7 +1,7 @@ import Dictionary from 'Common/Types/Dictionary'; import BadDataException from 'Common/Types/Exception/BadDataException'; -export default class JobDictonary { +export default class JobDictionary { private static dictionary: Dictionary = {}; public static getJobFunction(name: string): Function {