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

Return to reference type for config by unchecking Sendable conformance #206

Merged
merged 1 commit into from
Dec 2, 2024

Conversation

Jeehut
Copy link
Contributor

@Jeehut Jeehut commented Nov 26, 2024

I played around with different options, but all ideas I've had to resolve #192 and #201 included breaking changes that require documentation updates and users to update their code. After thinking about it again, I believe we should simply return to a reference type and mark the configuration file as @unchecked Sendable. This effectively turns off the compiler check for Sendable conformance and thread-safety. I think this is fine, firstly because we have our own synchronization mechanism in TelemetryManager when accessing the configuration:

   var configuration: TelemetryManagerConfiguration {
        get { queue.sync(flags: .barrier) { return _configuration } }
        set { queue.sync(flags: .barrier) { _configuration = newValue } }
    }

Secondly, configuration changes are rare, so even if we didn't have any syncing logic, this shouldn't affect users in practical usage as concurrent changes to the configuration is unlikely to happen.

Fixes #192 and fixes #201.

@Jeehut Jeehut merged commit 4c77613 into main Dec 2, 2024
6 checks passed
@Jeehut Jeehut deleted the feature/dynamic-config branch December 2, 2024 09:40
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
2 participants