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

Use SocketsHttpHandler.ConnectTimeout on connect #1829

Merged
merged 5 commits into from
Jul 29, 2022

Conversation

JamesNK
Copy link
Member

@JamesNK JamesNK commented Jul 27, 2022

Fixes #1828

src/Grpc.Net.Client/Balancer/Subchannel.cs Outdated Show resolved Hide resolved
var handler = new SocketsHttpHandler()
{
// ConnectTimeout is so small that CT will always be canceled before Socket is used.
ConnectTimeout = TimeSpan.FromTicks(1),
Copy link
Contributor

Choose a reason for hiding this comment

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

Doesn't TimeSpan.Zero work? We all know that using anything with real time will be flaky.
And Tick(1) actually means 15 milliseconds on windows which isn't super fast.

Copy link
Member Author

Choose a reason for hiding this comment

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

TimeSpan.Zero doesn't work. The server has just started up so it should take longer than 15ms to establish the first connection. If it proves flaky, I'll come up with a better idea.

@JamesNK JamesNK merged commit 5ff1804 into grpc:master Jul 29, 2022
@JamesNK JamesNK deleted the jamesnk/connecttimeout branch July 29, 2022 12:17
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.

ConnectTimeout option doesn't work since version 2.44
2 participants