This is an automated email from the ASF dual-hosted git repository.
chengyouling pushed a commit to branch 2.8.x
in repository https://gitbox.apache.org/repos/asf/servicecomb-java-chassis.git
The following commit(s) were added to refs/heads/2.8.x by this push:
new 0bcfdffb7 [#5141] fixed latest instance information cannot be obtained
when cache instances is empty problem. (#5142)
0bcfdffb7 is described below
commit 0bcfdffb74d9cb2827b70e02730ea4d72f143404
Author: Alex <[email protected]>
AuthorDate: Wed Jun 10 15:43:52 2026 +0800
[#5141] fixed latest instance information cannot be obtained when cache
instances is empty problem. (#5142)
---
.github/workflows/checkstyle.yml | 2 +-
.github/workflows/maven.yml | 2 +-
.github/workflows/rat_check.yml | 2 +-
.github/workflows/spotbugs.yml | 2 +-
.github/workflows/unit-test-jdk11.yml | 2 +-
.github/workflows/unit-test-jdk17.yml | 2 +-
.../servicecomb/service/center/client/ServiceCenterDiscovery.java | 7 +++++++
7 files changed, 13 insertions(+), 6 deletions(-)
diff --git a/.github/workflows/checkstyle.yml b/.github/workflows/checkstyle.yml
index dab1228a6..633179a60 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@v3
- name: Set up jdk
diff --git a/.github/workflows/maven.yml b/.github/workflows/maven.yml
index 6037e44da..4e070fa9a 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@v3
diff --git a/.github/workflows/rat_check.yml b/.github/workflows/rat_check.yml
index 0148c9020..0178e20cc 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@v3
- name: Set up jdk
diff --git a/.github/workflows/spotbugs.yml b/.github/workflows/spotbugs.yml
index dddae01a9..c4b32db17 100644
--- a/.github/workflows/spotbugs.yml
+++ b/.github/workflows/spotbugs.yml
@@ -26,7 +26,7 @@ on:
jobs:
spotbugs:
timeout-minutes: 60
- runs-on: ubuntu-latest
+ runs-on: ubuntu-24.04
steps:
- uses: actions/checkout@v3
- name: Set up jdk
diff --git a/.github/workflows/unit-test-jdk11.yml
b/.github/workflows/unit-test-jdk11.yml
index df2c21db1..648edc497 100644
--- a/.github/workflows/unit-test-jdk11.yml
+++ b/.github/workflows/unit-test-jdk11.yml
@@ -27,7 +27,7 @@ on:
jobs:
unit-tests:
timeout-minutes: 60
- runs-on: ubuntu-latest
+ runs-on: ubuntu-24.04
steps:
- uses: actions/checkout@v3
- name: Set up jdk
diff --git a/.github/workflows/unit-test-jdk17.yml
b/.github/workflows/unit-test-jdk17.yml
index 2604cd9c0..2ab71a35e 100644
--- a/.github/workflows/unit-test-jdk17.yml
+++ b/.github/workflows/unit-test-jdk17.yml
@@ -27,7 +27,7 @@ on:
jobs:
unit-tests:
timeout-minutes: 60
- runs-on: ubuntu-latest
+ runs-on: ubuntu-24.04
steps:
- uses: actions/checkout@v3
- name: Set up jdk
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 2598b52c2..a46e3a571 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;
@@ -296,9 +297,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)
{