-
Notifications
You must be signed in to change notification settings - Fork 1.2k
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
net/context support #239
Comments
Yes, that seems like a very good idea. Maybe we should wait a bit until the dust settles about |
I see no sign of |
Just two quick remarks:
|
I'm using you lib in this project: https://github.com/rs/rest-layer-es I already implemented timeout respecting context's deadline: https://github.com/rs/rest-layer-es/blob/master/util.go#L80 Now I'd like to respect cancellation as you mentioned in you point 1. The most obvious endpoints are |
I implemented the basics in |
Looks great :) |
Services in Elastic will now accept and honour `context.Context`. To do that, all services now have a `Do`/`DoC` pair of methods. The latter accepts a `context.Context`. `Client` implements this via `PerformRequest` and `PerformRequestC`. The latter will accept a `context.Context` as its first parameter. If a `context.Context` is passed, Elastic uses the context-aware `golang.org/x/net/context/ctxhttp` package to perform HTTP requests. See e.g. #239
It's been a looong time, but finally, in 3.0.48 you can use I will publish 3.0.48 soon. It is for Elasticsearch 2.x only. |
Awesome! |
Yes. It will be for |
Services could expose a
DoC(ctx context.Context)
method in addition to theirDo
command. When a context is passed, the underlaying HTTP request would handle the context's cancellation by using ctxhttp.The text was updated successfully, but these errors were encountered: