Skip to content
This repository has been archived by the owner on Apr 4, 2024. It is now read-only.

fix: ClientCaller bugs #191

Merged
merged 1 commit into from
Dec 10, 2022
Merged
Show file tree
Hide file tree
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
9 changes: 9 additions & 0 deletions src/main/java/vn/zalopay/benchmark/core/ClientCaller.java
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,7 @@
import java.nio.charset.StandardCharsets;
import java.util.LinkedHashMap;
import java.util.Map;
import java.util.concurrent.ExecutionException;
import java.util.concurrent.TimeUnit;
import java.util.stream.Collectors;

Expand Down Expand Up @@ -197,6 +198,14 @@ public GrpcResponse call(String deadlineMs) {
.blockingUnaryCall(requestMessages, streamObserver, callOptions(deadline))
.get();
} catch (Exception e) {
grpcResponse.setSuccess(false);
Throwable ex;
if (e instanceof ExecutionException) {
ex = e.getCause();
} else {
ex = e;
}
grpcResponse.setThrowable(ex);
shutdownNettyChannel();
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -167,7 +167,7 @@ public void testCanSendSampleRequestWithErrorNullResponse() {
grpcSampler.setHost(hostAndPort.getHost());
grpcSampler.setPort(Integer.toString(hostAndPort.getPort()));
grpcSampler.setFullMethod(FULL_METHOD);
grpcSampler.setDeadline("1");
grpcSampler.setDeadline("500");
grpcSampler.setTls(false);
grpcSampler.setTlsDisableVerification(false);
grpcSampler.setRequestJson(REQUEST_JSON);
Expand Down