add stream timeout option which defaults to 0 (#1456)

* add stream timeout option which defaults to 0

* fix option
This commit is contained in:
Asim Aslam
2020-03-31 23:22:11 +01:00
committed by GitHub
parent 1490aff38e
commit 68b0238a5d
3 changed files with 22 additions and 2 deletions

View File

@@ -57,6 +57,8 @@ type CallOptions struct {
Retries int
// Request/Response timeout
RequestTimeout time.Duration
// Stream timeout for the stream
StreamTimeout time.Duration
// Use the services own auth token
ServiceToken bool
@@ -227,6 +229,13 @@ func RequestTimeout(d time.Duration) Option {
}
}
// StreamTimeout sets the stream timeout
func StreamTimeout(d time.Duration) Option {
return func(o *Options) {
o.CallOptions.StreamTimeout = d
}
}
// Transport dial timeout
func DialTimeout(d time.Duration) Option {
return func(o *Options) {
@@ -295,6 +304,13 @@ func WithRequestTimeout(d time.Duration) CallOption {
}
}
// WithStreamTimeout sets the stream timeout
func WithStreamTimeout(d time.Duration) CallOption {
return func(o *CallOptions) {
o.StreamTimeout = d
}
}
// WithDialTimeout is a CallOption which overrides that which
// set in Options.CallOptions
func WithDialTimeout(d time.Duration) CallOption {