-
Notifications
You must be signed in to change notification settings - Fork 0
feat(optimizely): Make optimizely closeable. #4
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
base: mjamal/forwarding_event_processor
Are you sure you want to change the base?
feat(optimizely): Make optimizely closeable. #4
Conversation
optimizely/config_manager.py
Outdated
|
|
||
| def start(self): | ||
| """ Start the config manager and the thread to periodically fetch datafile. """ | ||
| if not self.is_running: |
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.
I think add a condition here, if it is already disposed, then don't need to start.
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.
Need to discuss.
optimizely/config_manager.py
Outdated
| """ Triggered as part of the thread which fetches the datafile and sleeps until next update interval. """ | ||
| try: | ||
| while self.is_running: | ||
| while self.is_running and self.control_flag and not self.disposed: |
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.
no need of any control flag. self.disposed should be fine.
optimizely/config_manager.py
Outdated
| self.control_flag = True | ||
| self._polling_thread.start() | ||
|
|
||
| def stop(self): |
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.
Close is fine, we may remove stop method.
optimizely/event/event_processor.py
Outdated
| if self.disposed: | ||
| return | ||
|
|
||
| self.stop() |
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.
same comment as config_manager
| self.decision_service = decision_service.DecisionService(self.logger, user_profile_service) | ||
| self._disposed = False | ||
|
|
||
| @property |
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.
why @property is needed, jus want to understand.
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.
To make it readonly that can only be updated from inside the class but not from outside the class.
msohailhussain
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.
please make changes.
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 to me.
- Add Unit test to make sure that on closing ConfigManager there will be no issue and plus we can't start it again (As discussed).
Note: @msohailhussain am still not sure why we are removing stop method from config_manager as it provides functionality of pause. This functionality is also available in java and Csharp as well. - Add summary.
Summary
The “why”, or other context.
Test plan
Issues