From 2febd48b580be20c54a70b3841b20757c6df239b Mon Sep 17 00:00:00 2001 From: tyson <953812503@qq.com> Date: Sun, 10 May 2020 18:45:58 +0800 Subject: [PATCH] fix query down node bug --- .../loadbalancer/DynamicServerListLoadBalancer.java | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/ribbon-loadbalancer/src/main/java/com/netflix/loadbalancer/DynamicServerListLoadBalancer.java b/ribbon-loadbalancer/src/main/java/com/netflix/loadbalancer/DynamicServerListLoadBalancer.java index a6a11c63a..857182729 100644 --- a/ribbon-loadbalancer/src/main/java/com/netflix/loadbalancer/DynamicServerListLoadBalancer.java +++ b/ribbon-loadbalancer/src/main/java/com/netflix/loadbalancer/DynamicServerListLoadBalancer.java @@ -258,10 +258,10 @@ protected void updateAllServerList(List ls) { // other threads might be doing this - in which case, we pass if (serverListUpdateInProgress.compareAndSet(false, true)) { try { - for (T s : ls) { - s.setAlive(true); // set so that clients can start using these - // servers right away instead - // of having to wait out the ping cycle. + // in case of querying down node when setting all new nodes alive + boolean[] results = super.pingStrategy.pingServers(ping, ls.toArray(new Server[ls.size()])); + for(int i = 0; i < ls.size(); i++) { + ls.get(i).setAlive(results[i]); } setServersList(ls); super.forceQuickPing();