Skip to content

Lack of context.Context support in Send/Receive #276

Answered by akshayjshah
GiedriusS asked this question in Q&A
Discussion options

You must be logged in to vote

Hi @GiedriusS - this would be great! Unfortunately, even if Send and Receive accepted a context, there's nothing useful we can do with it. 😿

Under the hood, all of these APIs are wrapping net/http.ResponseWriter.Write and net/http.Request.Body.Read. Neither of those methods takes a context or any other way to set a timeout. Especially since HTTP/2 supports multiple concurrent streams on each connection, there's not even much we can do with the net.Conn APIs. This is tracked and discussed pretty thoroughly in golang/go#16100, and it's also mentioned briefly in the Connect docs on deployment.

Clients take a context.Context for each RPC and set deadlines appropriately, so you can fan out at …

Replies: 3 comments

Comment options

You must be logged in to vote
0 replies
Answer selected by akshayjshah
Comment options

You must be logged in to vote
0 replies
Comment options

You must be logged in to vote
0 replies
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
3 participants
Converted from issue

This discussion was converted from issue #264 on June 07, 2022 15:02.