-
Notifications
You must be signed in to change notification settings - Fork 69
Add new client-connect-timeout arg #845
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
Conversation
cretz
left a comment
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.
LGTM, minor suggestion
temporalcli/client.go
Outdated
| ctx := context.Background() | ||
| ctx, _ = context.WithTimeoutCause(ctx, cctx.Options.ClientConnectTimeout, | ||
| fmt.Errorf("command timed out after %v", cctx.Options.ClientConnectTimeout)) |
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.
| 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
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.
- 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
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.
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
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.
ahh you're right, not sure why I just assumed canceling that context would cancel the client's context
## 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 -->
What was changed
Added new
client-connect-timeoutparamWhy?
Users requested
Checklist
Closes [Feature Request] Add
--client-connect-timeout#841How was this tested: