-
Notifications
You must be signed in to change notification settings - Fork 95
feat: Make clients and configurations sendable #2079
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
base: main
Are you sure you want to change the base?
Conversation
| @@ -58,7 +58,7 @@ extension ExplicitBlobInput { | |||
| val contents = getClientFileContents("Sources/Example", "ExampleClient.swift", context.manifest) | |||
| contents.shouldSyntacticSanityCheck() | |||
| val expectedContents = """ | |||
| public class ExampleClient: AWSClientRuntime.AWSServiceClient { | |||
| public final class ExampleClient: AWSClientRuntime.AWSServiceClient, Sendable { | |||
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.
Rather than explicitly mark every client, we should just add Sendable conformance to ClientRuntime.Client protocol
| @@ -82,7 +82,7 @@ public class ExampleClient: AWSClientRuntime.AWSServiceClient { | |||
|
|
|||
| extension ExampleClient { | |||
|
|
|||
| public class ExampleClientConfiguration: AWSClientRuntime.AWSDefaultClientConfiguration & AWSClientRuntime.AWSRegionClientConfiguration & ClientRuntime.DefaultClientConfiguration & ClientRuntime.DefaultHttpClientConfiguration { | |||
| public final class ExampleClientConfiguration: AWSClientRuntime.AWSDefaultClientConfiguration & AWSClientRuntime.AWSRegionClientConfiguration & ClientRuntime.DefaultClientConfiguration & ClientRuntime.DefaultHttpClientConfiguration, @unchecked Sendable { | |||
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.
I think we already discussed this, but using @unchecked Sendable here isn't appropriate because the client config is not actually safe to use across Swift Concurrency isolation boundaries; a class with var properties is not Sendable, even if the type of the var is Sendable.
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.
Discussed offline -- we want to refactor the configuration class to be a struct with immutable properties to achieve Sendability
Issue #
Description of changes
New/existing dependencies impact assessment, if applicable
Conventional Commits
By submitting this pull request, I confirm that my contribution is made under the terms of the Apache 2.0 license.