This is an automated email from the ASF dual-hosted git repository.
albumenj pushed a commit to branch 3.2
in repository https://gitbox.apache.org/repos/asf/dubbo.git
The following commit(s) were added to refs/heads/3.2 by this push:
new 5ea7803280 Fix xds long time wait (#10729)
5ea7803280 is described below
commit 5ea7803280751b9e8633e9d81ea0c61fef88e1af
Author: Albumen Kevin <[email protected]>
AuthorDate: Wed Oct 12 10:59:19 2022 +0800
Fix xds long time wait (#10729)
---
.../registry/xds/util/protocol/AbstractProtocol.java | 15 ++++++++++-----
1 file changed, 10 insertions(+), 5 deletions(-)
diff --git
a/dubbo-xds/src/main/java/org/apache/dubbo/registry/xds/util/protocol/AbstractProtocol.java
b/dubbo-xds/src/main/java/org/apache/dubbo/registry/xds/util/protocol/AbstractProtocol.java
index eb21cf3548..2d6dcb040b 100644
---
a/dubbo-xds/src/main/java/org/apache/dubbo/registry/xds/util/protocol/AbstractProtocol.java
+++
b/dubbo-xds/src/main/java/org/apache/dubbo/registry/xds/util/protocol/AbstractProtocol.java
@@ -226,17 +226,22 @@ public abstract class AbstractProtocol<T, S extends
DeltaResource<T>> implements
return;
}
observer.onNext(buildDiscoveryRequest(Collections.emptySet(),
value));
- CompletableFuture<T> future = streamResult.get(requestId);
- if (future == null) {
- return;
- }
- future.complete(result);
+ returnResult(result);
}
@Override
public void onError(Throwable t) {
logger.error("xDS Client received error message! detail:", t);
clear();
+ returnResult(null);
+ }
+
+ private void returnResult(T result) {
+ CompletableFuture<T> future = streamResult.get(requestId);
+ if (future == null) {
+ return;
+ }
+ future.complete(result);
}
@Override