Skip to content
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

Merged
merged 2 commits into from
Sep 24, 2024

Conversation

bitwiseguy
Copy link
Contributor

@bitwiseguy bitwiseguy commented Sep 24, 2024

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)

@bitwiseguy bitwiseguy marked this pull request as ready for review September 24, 2024 03:22
@bitwiseguy bitwiseguy requested a review from a team as a code owner September 24, 2024 03:22
Copy link
Contributor

@tynes tynes left a 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

@bitwiseguy bitwiseguy added this pull request to the merge queue Sep 24, 2024
Merged via the queue into develop with commit 0fee34b Sep 24, 2024
63 checks passed
@bitwiseguy bitwiseguy deleted the ss/service-call-with-context branch September 24, 2024 12:59
@@ -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")
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

remove?

Copy link
Contributor Author

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

Comment on lines +45 to +57
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
}
}
Copy link
Member

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)?

Copy link
Contributor Author

@bitwiseguy bitwiseguy Sep 24, 2024

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yea the new NewEngineAPIClientWithTimeout function is used by the replayor tool here for benchmark testing.

These two functions also used in the replayor here. Not currently used in any monorepo code

Comment on lines 65 to 81
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,
}
}
Copy link
Member

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.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants