Skip to content

Commit ac4a699

Browse files
authored
[#5141] fixed latest instance information cannot be obtained when cache instances is empty problem. (#5143)
1 parent ed86d04 commit ac4a699

6 files changed

Lines changed: 12 additions & 5 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@v6
3232
- name: Set up jdk

.github/workflows/linelint.yml

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

.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@v6

.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@v6
3535
- name: Set up jdk

.github/workflows/typo_check.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,7 @@ on:
2626
jobs:
2727
typo-check:
2828
timeout-minutes: 60
29-
runs-on: ubuntu-latest
29+
runs-on: ubuntu-24.04
3030
steps:
3131
- uses: actions/checkout@v6
3232
# To run the typo check locally, you can follow these steps:

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;
@@ -234,9 +235,15 @@ public void execute() {
234235
}
235236

236237
private synchronized void pullAllInstance() {
238+
List<SubscriptionKey> emptyInstancesCache = new ArrayList<>();
237239
instancesCache.forEach((k, v) -> {
238240
pullInstance(k, v, true);
241+
if (v.instancesCache.isEmpty()) {
242+
emptyInstancesCache.add(k);
243+
}
239244
});
245+
emptyInstancesCache.forEach(instancesCache::remove);
246+
emptyInstancesCache.clear();
240247
}
241248

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

0 commit comments

Comments
 (0)