-
Notifications
You must be signed in to change notification settings - Fork 0
feat: allow sdk consumers to choose their synchronization strategy #16
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
Conversation
dbe539b to
93076cb
Compare
aarsilv
left a comment
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.
Looks good small actual change then tons of changes from dereferencing to direct access 😛
| auto applicationLogger = std::make_shared<MyApplicationLogger>(); | ||
|
|
||
| auto client = std::make_shared<eppoclient::EppoClient>( | ||
| eppoclient::EppoClient client( |
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.
Ah ok this is why we change from dereferencing to access in the README 👍
| ## Thread Safety and Concurrency | ||
|
|
||
| The Eppo C++ SDK is **not thread-safe by design**. If you need to use the SDK from multiple threads, you are responsible for providing appropriate synchronization mechanisms in your application. |
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.
👌
| bool feature2 = client.getBoolAssignment("flag2", "user-123", attrs, false); | ||
| ``` | ||
| ### Multi-Threaded Usage (Synchronization Required) |
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.
Nice thinking including this
|
|
||
| Configuration ConfigurationStore::getConfiguration() const { | ||
| // Lock and get a copy of the shared_ptr | ||
| std::lock_guard<std::mutex> lock(configMutex_); |
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.
🪓
test/test_configuration_store.cpp
Outdated
| // Thread safety test removed - ConfigurationStore is no longer thread-safe by design. | ||
| // If thread-safety is required, the caller is responsible for providing synchronization. |
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.
This is covered in the README unsure if you need this in the test file
Eppo Internal:
🎟️ Fixes FFESUPPORT-331
Motivation and Context
We do not want to assume mutex-based synchronization so that we can let customers handle concurrency in whatever way their project requires.
Feedback from customer:
Description
Update code so that it runs as a single-threaded, letting customers handle concurrency.
How has this been documented?
README.md has been updated to reflect these changes
How has this been tested?
Tests updated and run, including example applications