Skip to content
New issue

Have a question about this project? # for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “#”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? # to your account

[ISSUE #42] 没有可用服务时,客户端线程会hang住 #43

Merged
merged 1 commit into from
Apr 19, 2023
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -149,23 +149,21 @@ private void doWatch(Listener2 listener) {

private void notifyListener(Listener2 listener, InstancesResponse response) {
ServiceInstances serviceInstances = response.toServiceInstances();
if (!serviceInstances.getInstances().isEmpty()) {
List<EquivalentAddressGroup> equivalentAddressGroups = serviceInstances.getInstances()
.stream()
.map(this::buildEquivalentAddressGroup)
.collect(Collectors.toList());
List<EquivalentAddressGroup> equivalentAddressGroups = serviceInstances.getInstances()
.stream()
.map(this::buildEquivalentAddressGroup)
.collect(Collectors.toList());

Attributes.Builder builder = Attributes.newBuilder();
Attributes.Builder builder = Attributes.newBuilder();

if (sourceService != null) {
builder.set(Common.SOURCE_SERVICE_INFO, sourceService);
}

listener.onResult(ResolutionResult.newBuilder()
.setAddresses(equivalentAddressGroups)
.setAttributes(builder.build())
.build());
if (sourceService != null) {
builder.set(Common.SOURCE_SERVICE_INFO, sourceService);
}

listener.onResult(ResolutionResult.newBuilder()
.setAddresses(equivalentAddressGroups)
.setAttributes(builder.build())
.build());
}

@Override
Expand Down