feat(optimizely): Make optimizely closeable.#4
Open
mariamjamal94 wants to merge 20 commits intomjamal/forwarding_event_processorfrom
Open
feat(optimizely): Make optimizely closeable.#4mariamjamal94 wants to merge 20 commits intomjamal/forwarding_event_processorfrom
mariamjamal94 wants to merge 20 commits intomjamal/forwarding_event_processorfrom
Conversation
optimizely/config_manager.py
Outdated
| @@ -308,4 +314,15 @@ def _run(self): | |||
| 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.
I think add a condition here, if it is already disposed, then don't need to start.
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.
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.
Close is fine, we may remove stop method.
optimizely/event/event_processor.py
Outdated
| if self.disposed: | ||
| return | ||
|
|
||
| self.stop() |
| self.decision_service = decision_service.DecisionService(self.logger, user_profile_service) | ||
| self._disposed = False | ||
|
|
||
| @property |
There was a problem hiding this comment.
why @property is needed, jus want to understand.
Owner
Author
There was a problem hiding this comment.
To make it readonly that can only be updated from inside the class but not from outside the class.
added 6 commits
August 9, 2019 18:23
mnoman09
reviewed
Aug 16, 2019
Collaborator
There was a problem hiding this comment.
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.
added 13 commits
August 16, 2019 19:12
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
The “why”, or other context.
Test plan
Issues