-
Notifications
You must be signed in to change notification settings - Fork 4.4k
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
how to set stream.Recv() timeout? #445
Comments
You can wait on another goroutine and cancel the stream if the timer fires. |
I don't think its a good way to rely on a separate goroutine. Why not build the timeout feature in like using context ? |
To be clear, the scope of context is rpc (either unary or streaming) instead of a particular message. |
I'm wondering if this is that clear on the documentation. It really deserves a "Client-Server Synchronization" and "Handling errors" chapters. |
absolutly, doc is not clear enough |
@iamqizhao how to cancel a strem.recv() for bidi-streaming rpc at server side. I not find any stream mehtod. |
@jan4984 You can cancel a stream by canceling the context used to create it. |
@MakMukhi no, I mean the server side. The stream is allocated by gRPC framewok. |
@jan4984 You would return from the goroutine that received the stream. |
@nhooyr but how can I return if I'm blocking at recv() call |
@jan4984 recv in a different goroutine. |
See also #1229 (esp. this comment and below), which is about Send() deadlines but the same concepts/techniques apply. |
how to set stream.Recv() timeout?
The text was updated successfully, but these errors were encountered: