Commit a91c8097 by lepdou

fix

parent 56c36b72
...@@ -128,15 +128,13 @@ public class PortalSettings { ...@@ -128,15 +128,13 @@ public class PortalSettings {
} }
} else { } else {
//maybe meta server up but admin server down //maybe meta server up but admin server down
handleEnvDown(env); hasUpdateStatus = handleEnvDown(env);
hasUpdateStatus = true;
} }
} catch (Exception e) { } catch (Exception e) {
//maybe meta server down //maybe meta server down
logger.warn("health check fail. [env:{}]", env, e.getMessage()); logger.warn("health check fail. [env:{}]", env, e.getMessage());
handleEnvDown(env); hasUpdateStatus = handleEnvDown(env);
hasUpdateStatus = true;
} }
} }
...@@ -151,13 +149,17 @@ public class PortalSettings { ...@@ -151,13 +149,17 @@ public class PortalSettings {
return "UP".equals(health.getStatus().getCode()); return "UP".equals(health.getStatus().getCode());
} }
private void handleEnvDown(Env env) { private boolean handleEnvDown(Env env) {
long failCnt = healthCheckFailCnt.get(env); long failCnt = healthCheckFailCnt.get(env);
healthCheckFailCnt.put(env, ++failCnt); healthCheckFailCnt.put(env, ++failCnt);
if (failCnt >= ENV_DIED_THREADHOLD) { if (envStatusMark.get(env) && failCnt >= ENV_DIED_THREADHOLD){
envStatusMark.put(env, false); envStatusMark.put(env, false);
logger.error("env down [env:{}]", env); logger.error("env turn to down [env:{}]", env);
return true;
}else {
logger.warn("[env:{}] down yet.", env);
return false;
} }
} }
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment