diff --git a/src/probes.service.ts b/src/probes.service.ts index 62eb4e8..572d55a 100644 --- a/src/probes.service.ts +++ b/src/probes.service.ts @@ -14,29 +14,27 @@ export class ProbesService { ) {} public async checkProbe(probeName: ProbeType): Promise { - if (this.statusMap[probeName] === undefined) { - const check = this.options.checks[probeName]; - - if (check !== undefined) { - let newStatus: boolean; - - if (typeof check === 'function') { - const result = await check(); - - if (typeof result === 'object') { - newStatus = this.checkTerminusHealthResults([result]); - } else if (typeof result === 'boolean') { - newStatus = result; - } - } else { - const results = await Promise.all(check.map(async (f) => await f())); - newStatus = this.checkTerminusHealthResults(results); - } + const check = this.options.checks[probeName]; + + if (check !== undefined) { + let newStatus: boolean; + + if (typeof check === 'function') { + const result = await check(); - this.statusMap[probeName] = newStatus; + if (typeof result === 'object') { + newStatus = this.checkTerminusHealthResults([result]); + } else if (typeof result === 'boolean') { + newStatus = result; + } } else { - this.statusMap[probeName] = true; + const results = await Promise.all(check.map(async (f) => await f())); + newStatus = this.checkTerminusHealthResults(results); } + + this.statusMap[probeName] = newStatus; + } else { + this.statusMap[probeName] = true; } return this.statusMap[probeName];