You are viewing a plain text version of this content. The canonical link for it is here.
Posted to notifications@shenyu.apache.org by "dragon-zhang (via GitHub)" <gi...@apache.org> on 2023/02/10 04:56:28 UTC

[GitHub] [shenyu] dragon-zhang commented on a diff in pull request #4366: [ISSUE #4356] optimize UpstreamCheckService

dragon-zhang commented on code in PR #4366:
URL: https://github.com/apache/shenyu/pull/4366#discussion_r1102273081


##########
shenyu-admin/src/main/java/org/apache/shenyu/admin/service/impl/UpstreamCheckService.java:
##########
@@ -243,56 +258,91 @@ public void replace(final String selectorId, final List<CommonUpstream> commonUp
 
     private void scheduled() {
         try {
-            if (!ZOMBIE_SET.isEmpty()) {
-                ZOMBIE_SET.parallelStream().forEach(this::checkZombie);
-            }
-            if (!UPSTREAM_MAP.isEmpty()) {
-                UPSTREAM_MAP.forEach(this::check);
-            }
+            doCheck();
+            waitFinish();
         } catch (Exception e) {
             LOG.error("upstream scheduled check error -------- ", e);
         }
     }
 
+    private void doCheck() {
+        // check zombie
+        ZOMBIE_SET.parallelStream().forEach(this::checkZombie);
+        // check up
+        UPSTREAM_MAP.forEach(this::check);

Review Comment:
   Reserve the judgment and remove `parallelStream`.



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: notifications-unsubscribe@shenyu.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org