Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

blockingStub可以设置超时时间嘛 #121

Closed
xuzhiyong28 opened this issue Apr 7, 2024 · 2 comments
Closed

blockingStub可以设置超时时间嘛 #121

xuzhiyong28 opened this issue Apr 7, 2024 · 2 comments

Comments

@xuzhiyong28
Copy link

No description provided.

@endiaoekoe
Copy link
Contributor

No description provided.

hi, @xuzhiyong28
In gRPC, the blockingStub does not have a direct method to set a timeout. However, you can achieve a similar effect by using deadlines. Deadlines allow gRPC clients to specify how long they are willing to wait for an RPC to complete before it is terminated with an error like DEADLINE_EXCEEDED.
Here is an example of how you can set a deadline for a gRPC call using Java:
response = blockingStub.withDeadlineAfter(deadlineMs, TimeUnit.MILLISECONDS).doSomthing(request);

you may have a try.

@endiaoekoe
Copy link
Contributor

fixed in release 0.9.0

@lvs007 lvs007 closed this as completed May 22, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants