Skip to content

Conversation

@yuandrew
Copy link
Contributor

What was changed

Added new client-connect-timeout param

Why?

Users requested

Checklist

  1. Closes [Feature Request] Add --client-connect-timeout #841

  2. How was this tested:

  1. Any docs updates needed?

@yuandrew yuandrew requested review from a team as code owners August 25, 2025 21:17
Copy link
Member

@cretz cretz left a comment

Choose a reason for hiding this comment

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

LGTM, minor suggestion

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))
Copy link
Member

Choose a reason for hiding this comment

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

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()
  1. Need to have this based of the overall context (for things like canceling on SIGINT and such)
  2. Might as well call cancel() as just a good practice

Copy link
Contributor Author

Choose a reason for hiding this comment

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

  1. Can do, we've previously only been usingcontext.Background, since that's what Dial uses
  2. Wouldn't calling defer here immediately cancel the context before the client can even be used? Since this function returns the client

Copy link
Member

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

Copy link
Contributor Author

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

@yuandrew yuandrew merged commit 0ea7a8a into temporalio:main Aug 26, 2025
13 of 14 checks passed
@yuandrew yuandrew deleted the client-connect-timeout branch August 26, 2025 15:42
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 -->
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.

[Feature Request] Add --client-connect-timeout

2 participants