1
0
mirror of https://github.com/go-micro/go-micro.git synced 2025-06-12 22:07:47 +02:00

Add transport dial timeout

This commit is contained in:
Asim
2016-01-03 21:25:03 +00:00
parent 332a229169
commit d43d3e8efa
4 changed files with 32 additions and 8 deletions

View File

@ -20,6 +20,7 @@ type Options struct {
Wrappers []Wrapper
Retries int
RequestTimeout time.Duration
DialTimeout time.Duration
// Other options to be used by client implementations
Options map[string]string
@ -49,6 +50,7 @@ func newOptions(options ...Option) Options {
Codecs: make(map[string]codec.NewCodec),
Retries: DefaultRetries,
RequestTimeout: DefaultRequestTimeout,
DialTimeout: transport.DefaultDialTimeout,
}
for _, o := range options {
@ -145,6 +147,13 @@ func RequestTimeout(d time.Duration) Option {
}
}
// Transport dial timeout
func DialTimeout(d time.Duration) Option {
return func(o *Options) {
o.DialTimeout = d
}
}
// Call Options
func WithSelectOption(so selector.SelectOption) CallOption {