From 36f1b1dd1e5e5a5f28cfe9973e8699e002f0f810 Mon Sep 17 00:00:00 2001 From: hexiaofeng Date: Thu, 2 Jan 2025 14:14:36 +0800 Subject: [PATCH] Change the ratio of grpc demo exception --- .../agent/demo/grpc/provider/service/UserServiceGrpcImpl.java | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/joylive-demo/joylive-demo-grpc/joylive-demo-grpc-provider/src/main/java/com/jd/live/agent/demo/grpc/provider/service/UserServiceGrpcImpl.java b/joylive-demo/joylive-demo-grpc/joylive-demo-grpc-provider/src/main/java/com/jd/live/agent/demo/grpc/provider/service/UserServiceGrpcImpl.java index 26f6fb72..ec7a392b 100644 --- a/joylive-demo/joylive-demo-grpc/joylive-demo-grpc-provider/src/main/java/com/jd/live/agent/demo/grpc/provider/service/UserServiceGrpcImpl.java +++ b/joylive-demo/joylive-demo-grpc/joylive-demo-grpc-provider/src/main/java/com/jd/live/agent/demo/grpc/provider/service/UserServiceGrpcImpl.java @@ -26,7 +26,7 @@ public class UserServiceGrpcImpl extends UserServiceGrpc.UserServiceImplBase { @Override public void get(UserGetRequest request, StreamObserver responseObserver) { - if (ThreadLocalRandom.current().nextBoolean()) { + if (ThreadLocalRandom.current().nextInt(5) == 0) { responseObserver.onError(new RuntimeException("error")); return; }