Conversation
🦋 Changeset detectedLatest commit: 2b3b0c8 The changes in this PR will be included in the next version bump. This PR includes changesets to release 1 package
Not sure what this means? Click here to learn what changesets are. Click here if you're a maintainer who wants to add another changeset to this PR |
290e116 to
4390dfa
Compare
|
So we are exposing context for each public method in this PR, which means user can pass down their own context with timeout, but then inside each method we override it with the RetryConfig timeout value, should we honour their timeout too or not? I would expect that if a method accepts context , it should uses it like A thought is that if we really want to enforce our own timeout, maybe we could set out own timeout if there are no existing timeout set in the user pass in context? Not super sure, lets see what everyone else thinks. func WithTimeoutIfNone(parent context.Context, timeout time.Duration) (context.Context, context.CancelFunc) {
// Check if the parent context already has a deadline
if _, hasDeadline := parent.Deadline(); hasDeadline {
// Return the original context and a no-op cancel function
return parent, func() {}
}
// No deadline: apply timeout
return context.WithTimeout(parent, timeout)
}
// usage
ctx, cancel := WithTimeoutIfNone(ctx, DEFAULT_TIMEOUT)Also with WaitMined, then now there is some inconsistency, a new user could set timeout on the RetryConfig but then doent know that it doesnt affect WaitMined but it affect the rest, a surprise? |
Good question. I looked into the
For |
Sounds good! lets make sure we comment it so users know as well |
2c7289e to
ae836e6
Compare
This PR was opened by the [Changesets release](https://github.com/changesets/action) GitHub action. When you're ready to do a release, you can merge this and the packages will be published to npm automatically. If you're not ready to do a release yet, that's fine, whenever you add more changesets to main, this PR will be updated. # Releases ## chainlink-deployments-framework@0.1.3 ### Patch Changes - [#84](#84) [`b3fec25`](b3fec25) Thanks [@giogam](https://github.com/giogam)! - feat(multiclient): adds timeouts to retryWithBackups and dialWithRetry --------- Co-authored-by: app-token-issuer-engops[bot] <144731339+app-token-issuer-engops[bot]@users.noreply.github.com>
This PR enhances the
MultiClientimplementation by adding timeout support and improving test coverage.Timeout Handling:
TimeoutandDialTimeouttoRetryConfig, with defaults for RPC and dial operations.retryWithBackupsanddialWithRetryto usecontext.WithTimeout, enforcing timeouts for RPC calls and connections.Context Propagation:
Test Improvements:
TestMultiClient_dialWithRetryto cover dial timeouts and failure scenarios.TestMultiClient_retryWithBackupsto simulate timeouts and long-running operations using context.