splited if to inner if

This commit is contained in:
Janne Nowak 2023-05-18 09:55:33 +02:00
parent f30f00655f
commit f604d96c5b

View File

@ -575,12 +575,14 @@ class Monitor extends BeanModel {
log.debug("monitor", `[${this.name}] Axios Request`); log.debug("monitor", `[${this.name}] Axios Request`);
let res = await axios.request(options); let res = await axios.request(options);
if (res.data.State.Health && res.data.State.Health.Status !== "healthy" && res.data.State.Running) { if (res.data.State.Running) {
bean.status = PENDING; if (res.data.State.Health && res.data.State.Health.Status !== "healthy") {
bean.msg = res.data.State.Health.Status; bean.status = PENDING;
} else if (res.data.State.Running) { bean.msg = res.data.State.Health.Status;
bean.status = UP; } else {
bean.msg = res.data.State.Health ? res.data.State.Health.Status : res.data.State.Status; bean.status = UP;
bean.msg = res.data.State.Health ? res.data.State.Health.Status : res.data.State.Status;
}
} else { } else {
throw Error("Container State is " + res.data.State.Status); throw Error("Container State is " + res.data.State.Status);
} }