-
Notifications
You must be signed in to change notification settings - Fork 19
fix: Update built-in map-based ExperimentOverrideStore implementation to be concurrently usable #171
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
…e concurrently usable.
thomaszurkan-optimizely
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.
https://godoc.org/golang.org/x/sync/syncmap why not use sync map instead?
|
@thomaszurkan-optimizely Based on reading this: https://golang.org/pkg/sync/#Map I gather that Also, aside from all that, can we even use it if we want our SDK to be usable in version <1.9? |
mikeproeng37
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.
Lgtm, just have a suggestion in the test
| user3Decision, _ := s.overrideService.GetDecision(testDecisionContext, entities.UserContext{ | ||
| ID: "test_user_3", | ||
| }) | ||
| s.NotNil(user1Decision.Variation) |
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.
Can you also assert that the decision variation key matches what you expected?
The built-in default implementation of
ExperimentOverrideStoreshould be production ready, so it should be safe to use concurrently.In this PR:
MapExperimentOverridesStoresync.RWLockis added toMapExperimentOverridesStoreSetVariationmethod is added for setting an override, which uses the mutexGetVariationmethod is updated to use the mutexGetVariationandSetVariationconcurrently from several goroutines