nitox icon indicating copy to clipboard operation
nitox copied to clipboard

Suppport for timeout in NatsClient.request method.

Open thedodd opened this issue 6 years ago • 1 comments

As described in the Nats FAQ here, it is assumed that users should be able to specify timeouts when making requests (request/response pattern).

We can use tokio's timeout system to accomplish this fairly easily. End users could do this on their own, but it would be awesome to be able to encapsulate this functionality as an Option<Duration> arg to the methods to which this would apply.

How do you guys feel about this? I am happy to write the code for it. Should be dead simple. Literally just wrapping the future in a timeout if a delay is given, else the code stays the same.

Thoughts?

thedodd avatar Feb 07 '19 18:02 thedodd

Would be super cool indeed!

We are using requests timeouts in prod, but since nitox is wrapped by actix-nats and we use the timeouts provided by actix, the leaf future allows us to cancel the whole future altogether, I didn't think of adding the feature to nitox itself.

OtaK avatar Feb 21 '19 11:02 OtaK