-
Notifications
You must be signed in to change notification settings - Fork 28
feat(Decide): Add Optimizely User Context #273
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
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 except for questions about concurrency support.
expected_attributes['browser'] = 'chrome' | ||
|
||
expect(user_context_obj.instance_variable_get(:@user_attributes)). to eq(expected_attributes) | ||
end |
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 we add a test - when the caller change its attribute copy after userContext is created, it should not be reflected to userContext?
def initialize(optimizely_client, user_id, user_attributes) | ||
@optimizely_client = optimizely_client | ||
@user_id = user_id | ||
@user_attributes = user_attributes |
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.
Does this create a copy of the passed user_attributes, so it's not reflected when the client copy is changed later?
end | ||
|
||
def set_attribute(attribute_key, attribute_value) | ||
@user_attributes[attribute_key] = attribute_value |
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.
"set_attribute" can be called concurrently with get-attributes from the userContext. Don't we need to synchronization for attributes read/write?
9088
Closing in favour of #274 |
Summary
This is the first PR for Decide API.
This PR adds
Test plan
Added Unit tests.