Skip to content

Accurately apply the connect timeout in async code #616

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

Merged
merged 2 commits into from
Aug 16, 2022

Conversation

Lukasa
Copy link
Collaborator

@Lukasa Lukasa commented Aug 16, 2022

Motivation

We should apply the connect timeout to the complete set of connection
attempts, rather than the request deadline. This allows users
fine-grained control over how long we attempt to connect for. This is
also the behaviour of our old-school interface.

Modifications

  • Changed the connect deadline calculation for async/await to match that
    of the future-based code.
  • Added a connect timeout test.

Result

Connect timeouts are properly handled

Motivation

We should apply the connect timeout to the complete set of connection
attempts, rather than the request deadline. This allows users
fine-grained control over how long we attempt to connect for. This is
also the behaviour of our old-school interface.

Modifications

- Changed the connect deadline calculation for async/await to match that
  of the future-based code.
- Added a connect timeout test.

Result

Connect timeouts are properly handled
@Lukasa Lukasa added the 🔨 semver/patch No public API change. label Aug 16, 2022
@Lukasa Lukasa requested review from artemredkin and dnadoba August 16, 2022 11:41
Copy link
Collaborator

@dnadoba dnadoba left a comment

Choose a reason for hiding this comment

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

Great patch! Thanks for fixing this!

@Lukasa
Copy link
Collaborator Author

Lukasa commented Aug 16, 2022

Nightly fails due to missing Sendable checks.

@Lukasa Lukasa merged commit e294c8f into swift-server:main Aug 16, 2022
@Lukasa Lukasa deleted the cb-better-connect-timeout branch August 16, 2022 12:18
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
🔨 semver/patch No public API change.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants