Add new client-connect-timeout arg#845
Merged
yuandrew merged 4 commits intotemporalio:mainfrom Aug 26, 2025
Merged
Conversation
cretz
reviewed
Aug 25, 2025
temporalcli/client.go
Outdated
Comment on lines
210
to
212
| ctx := context.Background() | ||
| ctx, _ = context.WithTimeoutCause(ctx, cctx.Options.ClientConnectTimeout, | ||
| fmt.Errorf("command timed out after %v", cctx.Options.ClientConnectTimeout)) |
Member
There was a problem hiding this comment.
Suggested change
| ctx := context.Background() | |
| ctx, _ = context.WithTimeoutCause(ctx, cctx.Options.ClientConnectTimeout, | |
| fmt.Errorf("command timed out after %v", cctx.Options.ClientConnectTimeout)) | |
| ctx, cancel := context.WithTimeoutCause(cctx, cctx.Options.ClientConnectTimeout, | |
| fmt.Errorf("command timed out after %v", cctx.Options.ClientConnectTimeout)) | |
| defer cancel() |
- Need to have this based of the overall context (for things like canceling on SIGINT and such)
- Might as well call
cancel()as just a good practice
Contributor
Author
There was a problem hiding this comment.
- Can do, we've previously only been using
context.Background, since that's whatDialuses - Wouldn't calling defer here immediately cancel the context before the client can even be used? Since this function returns the client
Member
There was a problem hiding this comment.
Wouldn't calling defer here immediately cancel the context before the client can even be used? Since this function returns the client
It'd cancel the dial context, which is only for the purposes of the dial call IIUC
Contributor
Author
There was a problem hiding this comment.
ahh you're right, not sure why I just assumed canceling that context would cancel the client's context
cretz
approved these changes
Aug 26, 2025
stephanos
pushed a commit
to sivagirish81/cli
that referenced
this pull request
Oct 2, 2025
## What was changed <!-- Describe what has changed in this PR --> Added new `client-connect-timeout` param ## Why? <!-- Tell your future self why have you made these changes --> Users requested ## Checklist <!--- add/delete as needed ---> 1. Closes temporalio#841 2. How was this tested: <!--- Please describe how you tested your changes/how we can test them --> 3. Any docs updates needed? <!--- update README if applicable or point out where to update docs.temporal.io -->
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
What was changed
Added new
client-connect-timeoutparamWhy?
Users requested
Checklist
Closes [Feature Request] Add
--client-connect-timeout#841How was this tested: