From f604d96c5bc52b984b66d611658456ce2cf9b00a Mon Sep 17 00:00:00 2001 From: Janne Nowak Date: Thu, 18 May 2023 09:55:33 +0200 Subject: [PATCH] splited if to inner if --- server/model/monitor.js | 14 ++++++++------ 1 file changed, 8 insertions(+), 6 deletions(-) diff --git a/server/model/monitor.js b/server/model/monitor.js index 42fb20c6a..9a6ac1d3b 100644 --- a/server/model/monitor.js +++ b/server/model/monitor.js @@ -575,12 +575,14 @@ class Monitor extends BeanModel { log.debug("monitor", `[${this.name}] Axios Request`); let res = await axios.request(options); - if (res.data.State.Health && res.data.State.Health.Status !== "healthy" && res.data.State.Running) { - bean.status = PENDING; - bean.msg = res.data.State.Health.Status; - } else if (res.data.State.Running) { - bean.status = UP; - bean.msg = res.data.State.Health ? res.data.State.Health.Status : res.data.State.Status; + if (res.data.State.Running) { + if (res.data.State.Health && res.data.State.Health.Status !== "healthy") { + bean.status = PENDING; + bean.msg = res.data.State.Health.Status; + } else { + bean.status = UP; + bean.msg = res.data.State.Health ? res.data.State.Health.Status : res.data.State.Status; + } } else { throw Error("Container State is " + res.data.State.Status); }