Skip to content

Make async/await available on older Apple Platforms #527

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 7 commits into from
Dec 17, 2021

Conversation

dnadoba
Copy link
Collaborator

@dnadoba dnadoba commented Dec 14, 2021

Motivation

With Xcode 13.2, and therefore Swift 5.5.2, Swift Concurrency is supported on older Apple OSs. async/await support will no longer be available on Swift before 5.5.2 but this isn't a breaking change because we have not yet made anything of it public.

Changes

  • replace all #if compiler(>=5.5) && canImport(_Concurrency) with #if compiler(>=5.5.2) && canImport(_Concurrency)
  • replace all available(macOS 12.0, iOS 15.0, watchOS 8.0, tvOS 15.0, *) with available(macOS 10.15, iOS 13.0, watchOS 6.0, tvOS 13.0, *)

@dnadoba dnadoba added the 🔨 semver/patch No public API change. label Dec 14, 2021
@dnadoba dnadoba requested a review from fabianfett December 14, 2021 19:36
Copy link
Member

@fabianfett fabianfett left a comment

Choose a reason for hiding this comment

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

LGTM. @glbrntt do you mind giving this a look?

@fabianfett fabianfett requested a review from glbrntt December 17, 2021 13:20
### Motivation
Calling `HTTPClient.shutdown()` may never return if connections are still starting and one new established connection results in a state migration (i.e. from HTTP1 to HTTP2 or vice versa). We forgot to migrate the shutdown state. This could result in a large dealy until `.shutdown()` returns because we wait until connections are closed because of idle timeout. Worse, it could also never return if more requests are queued because the connections would not be idle and therefore not close itself.
###Changes
- Mirgrate shutdown state too
- add tests for this specific case
### Motivation
With Xcode 13.2, and therefore Swift 5.5.2, Swift Concurrecy is supported on older Apple OSs. async/await suport will no longer be available on Swift before `5.5.2` but this isn't a breaking change because we have not yet made anything of it public.

### Changes
- replace all `#if compiler(>=5.5) && canImport(_Concurrency)` with `#if compiler(>=5.5.2) && canImport(_Concurrency)`
- replace all `available(macOS 12.0, iOS 15.0, watchOS 8.0, tvOS 15.0, *)` with `available(macOS 10.15, iOS 13.0, watchOS 6.0, tvOS 13.0, *)`
@@ -16,7 +16,7 @@
import NIOConcurrencyHelpers
import NIOCore

@available(macOS 12.0, iOS 15.0, watchOS 8.0, tvOS 15.0, *)
@available(macOS 10.15, iOS 13.0, watchOS 6.0, tvOS 13.0, *)
Copy link
Collaborator

Choose a reason for hiding this comment

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

Only tests, but presumably the #if swift above needs to be updated too?

Copy link
Collaborator

@glbrntt glbrntt left a comment

Choose a reason for hiding this comment

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

LGTM

@dnadoba dnadoba merged commit d372bdc into swift-server:main Dec 17, 2021
@dnadoba dnadoba deleted the dn-swift-5.5.2 branch December 17, 2021 15:08
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