This is an automated email from the ASF dual-hosted git repository.
icodening 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 95f9984571 fix triple reactor call throws "Too many response for unary
method" exception (#14261)
95f9984571 is described below
commit 95f99845713ac4ab98201c4e83052411a23736f6
Author: caoyanan666 <[email protected]>
AuthorDate: Fri May 31 16:26:59 2024 +0800
fix triple reactor call throws "Too many response for unary method"
exception (#14261)
Co-authored-by: caoyanan <[email protected]>
---
.../java/org/apache/dubbo/reactive/calls/ReactorServerCalls.java | 8 +++-----
1 file changed, 3 insertions(+), 5 deletions(-)
diff --git
a/dubbo-plugin/dubbo-reactive/src/main/java/org/apache/dubbo/reactive/calls/ReactorServerCalls.java
b/dubbo-plugin/dubbo-reactive/src/main/java/org/apache/dubbo/reactive/calls/ReactorServerCalls.java
index 24218a1b08..8cf1ef3ed8 100644
---
a/dubbo-plugin/dubbo-reactive/src/main/java/org/apache/dubbo/reactive/calls/ReactorServerCalls.java
+++
b/dubbo-plugin/dubbo-reactive/src/main/java/org/apache/dubbo/reactive/calls/ReactorServerCalls.java
@@ -48,13 +48,11 @@ public final class ReactorServerCalls {
public static <T, R> void oneToOne(T request, StreamObserver<R>
responseObserver, Function<Mono<T>, Mono<R>> func) {
try {
func.apply(Mono.just(request))
+
.switchIfEmpty(Mono.error(TriRpcStatus.NOT_FOUND.asException()))
.subscribe(
- res -> {
- responseObserver.onNext(res);
- responseObserver.onCompleted();
- },
+ responseObserver::onNext,
throwable -> doOnResponseHasException(throwable,
responseObserver),
- () ->
doOnResponseHasException(TriRpcStatus.NOT_FOUND.asException(),
responseObserver));
+ responseObserver::onCompleted);
} catch (Throwable throwable) {
doOnResponseHasException(throwable, responseObserver);
}