Skip to content

Commit

Permalink
Change the ratio of grpc demo exception
Browse files Browse the repository at this point in the history
  • Loading branch information
hexiaofeng committed Jan 2, 2025
1 parent 9b2dcee commit 36f1b1d
Showing 1 changed file with 1 addition and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ public class UserServiceGrpcImpl extends UserServiceGrpc.UserServiceImplBase {

@Override
public void get(UserGetRequest request, StreamObserver<UserGetResponse> responseObserver) {
if (ThreadLocalRandom.current().nextBoolean()) {
if (ThreadLocalRandom.current().nextInt(5) == 0) {
responseObserver.onError(new RuntimeException("error"));
return;
}
Expand Down

0 comments on commit 36f1b1d

Please sign in to comment.