-
Notifications
You must be signed in to change notification settings - Fork 3.3k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
op-service: add configurable client timeout #12074
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Nice! Confirming that the previous default values are used so there should be no changes in practice
@@ -66,6 +66,7 @@ func (l *LazyRPC) CallContext(ctx context.Context, result any, method string, ar | |||
if err := l.dial(ctx); err != nil { | |||
return err | |||
} | |||
fmt.Println("checkpoin 1") |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
remove?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Oops yea good catch. Cleanup pr here: #12083
func WithCallTimeout(d time.Duration) RPCOption { | ||
return func(cfg *rpcConfig) error { | ||
cfg.callTimeout = d | ||
return nil | ||
} | ||
} | ||
|
||
func WithBatchCallTimeout(d time.Duration) RPCOption { | ||
return func(cfg *rpcConfig) error { | ||
cfg.batchCallTimeout = d | ||
return nil | ||
} | ||
} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Do I see correctly that these aren't used anywhere (yet)?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
func NewEngineAPIClient(rpc client.RPC, l log.Logger, evp EngineVersionProvider) *EngineAPIClient { | ||
return &EngineAPIClient{ | ||
RPC: rpc, | ||
log: l, | ||
evp: evp, | ||
RPC: rpc, | ||
log: l, | ||
evp: evp, | ||
timeout: time.Second * 5, | ||
} | ||
} | ||
|
||
func NewEngineAPIClientWithTimeout(rpc client.RPC, l log.Logger, evp EngineVersionProvider, timeout time.Duration) *EngineAPIClient { | ||
return &EngineAPIClient{ | ||
RPC: rpc, | ||
log: l, | ||
evp: evp, | ||
timeout: timeout, | ||
} | ||
} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
You could use the options pattern here instead, by creating a type EngineAPIClientOption func(*EngineAPIClient)
and then receiving a variadic parameter of options and applying them. Then you could create a WithTimeout(time.Duration)
option.
Adds
NewEngineAPIClientWithTimeout
which allows for a configurable timeout parameter to be passed. Useful for testing outlier engine api calls in the replayor execution client benchmarking tool(h/t @danyalprout)