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

fix: enhance thread safety of properties #257

Merged
merged 2 commits into from
Jan 23, 2025

Conversation

sojingle
Copy link
Collaborator

Summary

Enhance thread safety

  • Add locks to lazy vars in Amplitude
    Lazy variables are not thread-safe. They may be initialized multiple times if accessed in multiple threads.
  • Add a lock to protect Diagnostics collection properties
    They are accessed on multiple threads. Considering the low access frequency, use one lock to keep it simple.

Checklist

  • Does your PR title have the correct title format?
  • Does your PR have a breaking change?: no

@sojingle sojingle requested a review from crleona January 22, 2025 19:22
@sojingle sojingle force-pushed the AMP-122203-thread-safety-enhance branch from db1c8b0 to b84f553 Compare January 22, 2025 20:07
Sources/Amplitude/Amplitude.swift Outdated Show resolved Hide resolved
@sojingle sojingle merged commit 8ffcc65 into main Jan 23, 2025
9 checks passed
@sojingle sojingle deleted the AMP-122203-thread-safety-enhance branch January 23, 2025 19:53
github-actions bot pushed a commit that referenced this pull request Jan 23, 2025
## [1.11.3](v1.11.2...v1.11.3) (2025-01-23)

### Bug Fixes

* enhance thread safety of properties ([#257](#257)) ([8ffcc65](8ffcc65))
Copy link

🎉 This PR is included in version 1.11.3 🎉

The release is available on:

Your semantic-release bot 📦🚀

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants