This is an automated email from the ASF dual-hosted git repository.

chengyouling pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/servicecomb-java-chassis.git


The following commit(s) were added to refs/heads/master by this push:
     new ac4a6991e [#5141] fixed latest instance information cannot be obtained 
when cache instances is empty problem. (#5143)
ac4a6991e is described below

commit ac4a6991e6334607b786607ad1e60638ff6ad4bf
Author: Alex <[email protected]>
AuthorDate: Wed Jun 10 15:44:12 2026 +0800

    [#5141] fixed latest instance information cannot be obtained when cache 
instances is empty problem. (#5143)
---
 .github/workflows/checkstyle.yml                                   | 2 +-
 .github/workflows/linelint.yml                                     | 2 +-
 .github/workflows/maven.yml                                        | 2 +-
 .github/workflows/rat_check.yml                                    | 2 +-
 .github/workflows/typo_check.yml                                   | 2 +-
 .../servicecomb/service/center/client/ServiceCenterDiscovery.java  | 7 +++++++
 6 files changed, 12 insertions(+), 5 deletions(-)

diff --git a/.github/workflows/checkstyle.yml b/.github/workflows/checkstyle.yml
index e5e7309b4..3f97b9f18 100644
--- a/.github/workflows/checkstyle.yml
+++ b/.github/workflows/checkstyle.yml
@@ -26,7 +26,7 @@ on:
 jobs:
   checkstyle:
     timeout-minutes: 60
-    runs-on: ubuntu-latest
+    runs-on: ubuntu-24.04
     steps:
       - uses: actions/checkout@v6
       - name: Set up jdk
diff --git a/.github/workflows/linelint.yml b/.github/workflows/linelint.yml
index 49bafa758..8d5112ea3 100644
--- a/.github/workflows/linelint.yml
+++ b/.github/workflows/linelint.yml
@@ -26,7 +26,7 @@ on:
 jobs:
   linelint:
     timeout-minutes: 60
-    runs-on: ubuntu-latest
+    runs-on: ubuntu-24.04
     steps:
       - uses: actions/checkout@v6
       - name: install linelint
diff --git a/.github/workflows/maven.yml b/.github/workflows/maven.yml
index 0d2676fe7..24118c35c 100644
--- a/.github/workflows/maven.yml
+++ b/.github/workflows/maven.yml
@@ -29,7 +29,7 @@ jobs:
   build:
 
     timeout-minutes: 60
-    runs-on: ubuntu-latest
+    runs-on: ubuntu-24.04
 
     steps:
     - uses: actions/checkout@v6
diff --git a/.github/workflows/rat_check.yml b/.github/workflows/rat_check.yml
index 4abcc9447..c2db2508f 100644
--- a/.github/workflows/rat_check.yml
+++ b/.github/workflows/rat_check.yml
@@ -29,7 +29,7 @@ on:
 jobs:
   rat_check:
     timeout-minutes: 60
-    runs-on: ubuntu-latest
+    runs-on: ubuntu-24.04
     steps:
       - uses: actions/checkout@v6
       - name: Set up jdk
diff --git a/.github/workflows/typo_check.yml b/.github/workflows/typo_check.yml
index 745e63447..999530a79 100644
--- a/.github/workflows/typo_check.yml
+++ b/.github/workflows/typo_check.yml
@@ -26,7 +26,7 @@ on:
 jobs:
   typo-check:
     timeout-minutes: 60
-    runs-on: ubuntu-latest
+    runs-on: ubuntu-24.04
     steps:
       - uses: actions/checkout@v6
         # To run the typo check locally, you can follow these steps:
diff --git 
a/clients/service-center-client/src/main/java/org/apache/servicecomb/service/center/client/ServiceCenterDiscovery.java
 
b/clients/service-center-client/src/main/java/org/apache/servicecomb/service/center/client/ServiceCenterDiscovery.java
index 0056ed7a8..a1ab524c1 100644
--- 
a/clients/service-center-client/src/main/java/org/apache/servicecomb/service/center/client/ServiceCenterDiscovery.java
+++ 
b/clients/service-center-client/src/main/java/org/apache/servicecomb/service/center/client/ServiceCenterDiscovery.java
@@ -17,6 +17,7 @@
 
 package org.apache.servicecomb.service.center.client;
 
+import java.util.ArrayList;
 import java.util.Collections;
 import java.util.List;
 import java.util.Map;
@@ -234,9 +235,15 @@ public class ServiceCenterDiscovery extends AbstractTask {
   }
 
   private synchronized void pullAllInstance() {
+    List<SubscriptionKey> emptyInstancesCache = new ArrayList<>();
     instancesCache.forEach((k, v) -> {
       pullInstance(k, v, true);
+      if (v.instancesCache.isEmpty()) {
+        emptyInstancesCache.add(k);
+      }
     });
+    emptyInstancesCache.forEach(instancesCache::remove);
+    emptyInstancesCache.clear();
   }
 
   private static String instanceToString(List<MicroserviceInstance> instances) 
{

Reply via email to