fix(monitor): if monitor checks fail do not set a ping

This commit is contained in:
Bert Verhelst 2021-10-06 20:23:25 +02:00
parent 668c5a77d6
commit 786db6dada

View file

@ -153,8 +153,6 @@ class Monitor extends BeanModel {
maxRedirects: this.maxredirects,
validateStatus: undefined,
});
bean.msg = `${res.status} - ${res.statusText}`;
bean.ping = dayjs().valueOf() - startTime;
// Check certificate if https is used
let certInfoStartTime = dayjs().valueOf();
@ -170,7 +168,11 @@ class Monitor extends BeanModel {
debug("Cert Info Query Time: " + (dayjs().valueOf() - certInfoStartTime) + "ms");
bean.msg = `${res.status} - ${res.statusText}`;
validateMonitorChecks(res, await this.getMonitorChecks(), bean);
bean.ping = dayjs().valueOf() - startTime;
} else if (this.type === "port") {
bean.ping = await tcping(this.hostname, this.port);
bean.msg = "";