-
Notifications
You must be signed in to change notification settings - Fork 36
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
[FSSDK-10763] Implement UPS request batching for decideForKeys #440
base: master
Are you sure you want to change the base?
Conversation
…file` in decision logic. 🛠️ optimizely/user_profile.py -> Improved user profile loading with missing key checks. 🛠️ tests/test_decision_service.py -> Updated tests to include user profile tracker.
🛠️ tests/test_decision_service.py -> Updated experiment bucket map call. 🛠️ tests/test_decision_service.py -> Introduced user_profile_tracker usage. 🛠️ tests/test_decision_service.py -> Modified method calls with user_profile_tracker.
tests/test_decision_service.py -> Added user profile tracker object
tests/test_decision_service.py -> Fixed tests
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 great! Just please cleanup old commented out pieces. Then we'll merge once done :)
optimizely/decision_service.py
Outdated
self.user_profile_service.save(user_profile.__dict__) | ||
user_profile_tracker.update_user_profile(experiment, variation) | ||
if self.user_profile_service is not None: | ||
self.user_profile_service.save(user_profile_tracker.get_user_profile().__dict__) |
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 will cause the user profile service to be saved for each flag key, making the batching save ineffective. This if block should be removed
@@ -629,8 +632,11 @@ def get_variation( | |||
return None | |||
|
|||
user_context = OptimizelyUserContext(self, self.logger, user_id, attributes, False) | |||
|
|||
variation, _ = self.decision_service.get_variation(project_config, experiment, user_context) | |||
user_profile_tracker = user_profile.UserProfileTracker(user_id, self.user_profile_service, self.logger) |
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.
should there be a user_profile_service.load_user_profile()
call here. I suspect this could be a reason behind FSC failures
variation, _ = self.decision_service.get_variation(project_config, | ||
experiment, | ||
user_context, | ||
user_profile_tracker) |
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.
the user profile should be saved here as we will remove the save from get_variation() in decision service.
optimizely/optimizely.py -> Added loading and saving profile logic
optimizely/user_profile.py -> Testing user profile update logic
optimizely/user_profile.py -> Removed unused import statement
Summary
Test plan
Issues