Skip to content

Commit 0bcfdff

Browse files
authored
[#5141] fixed latest instance information cannot be obtained when cache instances is empty problem. (#5142)
1 parent 38e95a4 commit 0bcfdff

7 files changed

Lines changed: 13 additions & 6 deletions

File tree

.github/workflows/checkstyle.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,7 @@ on:
2626
jobs:
2727
checkstyle:
2828
timeout-minutes: 60
29-
runs-on: ubuntu-latest
29+
runs-on: ubuntu-24.04
3030
steps:
3131
- uses: actions/checkout@v3
3232
- name: Set up jdk

.github/workflows/maven.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,7 @@ jobs:
2929
build:
3030

3131
timeout-minutes: 60
32-
runs-on: ubuntu-latest
32+
runs-on: ubuntu-24.04
3333

3434
steps:
3535
- uses: actions/checkout@v3

.github/workflows/rat_check.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,7 @@ on:
2929
jobs:
3030
rat_check:
3131
timeout-minutes: 60
32-
runs-on: ubuntu-latest
32+
runs-on: ubuntu-24.04
3333
steps:
3434
- uses: actions/checkout@v3
3535
- name: Set up jdk

.github/workflows/spotbugs.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,7 @@ on:
2626
jobs:
2727
spotbugs:
2828
timeout-minutes: 60
29-
runs-on: ubuntu-latest
29+
runs-on: ubuntu-24.04
3030
steps:
3131
- uses: actions/checkout@v3
3232
- name: Set up jdk

.github/workflows/unit-test-jdk11.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,7 @@ on:
2727
jobs:
2828
unit-tests:
2929
timeout-minutes: 60
30-
runs-on: ubuntu-latest
30+
runs-on: ubuntu-24.04
3131
steps:
3232
- uses: actions/checkout@v3
3333
- name: Set up jdk

.github/workflows/unit-test-jdk17.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,7 @@ on:
2727
jobs:
2828
unit-tests:
2929
timeout-minutes: 60
30-
runs-on: ubuntu-latest
30+
runs-on: ubuntu-24.04
3131
steps:
3232
- uses: actions/checkout@v3
3333
- name: Set up jdk

clients/service-center-client/src/main/java/org/apache/servicecomb/service/center/client/ServiceCenterDiscovery.java

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,7 @@
1717

1818
package org.apache.servicecomb.service.center.client;
1919

20+
import java.util.ArrayList;
2021
import java.util.Collections;
2122
import java.util.List;
2223
import java.util.Map;
@@ -296,9 +297,15 @@ public void execute() {
296297
}
297298

298299
private synchronized void pullAllInstance() {
300+
List<SubscriptionKey> emptyInstancesCache = new ArrayList<>();
299301
instancesCache.forEach((k, v) -> {
300302
pullInstance(k, v, true);
303+
if (v.instancesCache.isEmpty()) {
304+
emptyInstancesCache.add(k);
305+
}
301306
});
307+
emptyInstancesCache.forEach(instancesCache::remove);
308+
emptyInstancesCache.clear();
302309
}
303310

304311
private static String instanceToString(List<MicroserviceInstance> instances) {

0 commit comments

Comments
 (0)