1
0
mirror of https://github.com/go-micro/go-micro.git synced 2025-08-04 21:42:57 +02:00

fix options

This commit is contained in:
asim
2025-07-07 10:23:23 +01:00
parent 680987aeeb
commit 7b48449a85

View File

@ -89,7 +89,7 @@ type CallOptions struct {
CallWrappers []CallWrapper CallWrappers []CallWrapper
// ConnectionTimeout of one request to the server. // ConnectionTimeout of one request to the server.
// Set this lower than the RequestTimeout to enbale retries on connection timeout. // Set this lower than the RequestTimeout to enable retries on connection timeout.
ConnectionTimeout time.Duration ConnectionTimeout time.Duration
// Request/Response timeout of entire srv.Call, for single request timeout set ConnectionTimeout. // Request/Response timeout of entire srv.Call, for single request timeout set ConnectionTimeout.
RequestTimeout time.Duration RequestTimeout time.Duration
@ -261,6 +261,13 @@ func Retry(fn RetryFunc) Option {
} }
} }
// ConnectionTimeout sets the connection timeout
func ConnectionTimeout(t time.Duration) Option {
return func(o *Options) {
o.CallOptions.ConnectionTimeout = t
}
}
// RequestTimeout set the request timeout. // RequestTimeout set the request timeout.
func RequestTimeout(d time.Duration) Option { func RequestTimeout(d time.Duration) Option {
return func(o *Options) { return func(o *Options) {