minghuaw / toy-rpc

An async RPC in rust-lang that mimics golang's net/rpc
29 stars 2 forks source link

Add default timeout duration? #9

Closed minghuaw closed 3 years ago

minghuaw commented 3 years ago

This is the tracking issue for discussion on a default timeout duration in version 0.8

minghuaw commented 3 years ago

Two options are being considered.

  1. Having a global default timeout duration (say something like 10 seconds)
  2. A configurable timeout duration that can be set with the client (client.set_default_timeout(duration: Duration)
Rustleman commented 3 years ago

I would prefer the second option: client.set_default_timeout(duration: Duration)

minghuaw commented 3 years ago

Now a default timeout of 10 seconds is set when a new client is created, but the default timeout can be changed with set_default_timeout(duration). If you are interested in setting the timeout only for the next RPC call, there is another method set_next_timeout(duration)

minghuaw commented 3 years ago

Re-opening this issue for future discussions on changing timeouts