elastic / elasticsearch-rs

Official Elasticsearch Rust Client
https://www.elastic.co/guide/en/elasticsearch/client/rust-api/current/index.html
Apache License 2.0
705 stars 72 forks source link

[ENHANCEMENT] timeout #116

Closed petar-dambovaliev closed 4 years ago

petar-dambovaliev commented 4 years ago

Is your feature request related to a problem? Please describe. You can't pass a timeout on this client

Describe the solution you'd like Pass a timeout to the client

Describe alternatives you've considered Pass a timeout to the client

Additional context Build a client + Transport with a timeout passed by the user

russcam commented 4 years ago

This would be a great feature to add, and would bring the client in line with other official clients. It should be possible to add a default timeout when building a transport, and be able to provide a timeout for individual requests. For individual requests, the api_generator would be updated to add a timeout function for all generated builder structs, similar to header function

https://github.com/elastic/elasticsearch-rs/blob/e0bf029b67b1fea2095f06e8a700971956dc0174/api_generator/src/generator/code_gen/request/request_builder.rs#L311-L351

In future, we probably want to group transport-related functions on builder structs together e.g. transport() that accepts some type to apply changes to transport, but that doesn't need to be part of this.

@petar-dambovaliev Is this something you'd be interested in taking a crack at?

petar-dambovaliev commented 4 years ago

@russcam sure, i can give it a go.

russcam commented 4 years ago

Awesome, @petar-dambovaliev! Happy to provide input or be a sounding board

russcam commented 4 years ago

@petar-dambovaliev I was considering taking a look at this shortly. Did you still have plans to take a look at it, if not, mind if I take it on?

russcam commented 4 years ago

I've opened #132 to address