Skip to content

Conversation

@mariamjamal94
Copy link
Owner

Summary

  • The “what”; a concise description of each logical change
  • Another change

The “why”, or other context.

Test plan

Issues

@mariamjamal94 mariamjamal94 requested a review from mnoman09 August 6, 2019 12:07
@mariamjamal94 mariamjamal94 changed the title feat: Make optimizely closeable. feat(optimizely): Make optimizely closeable. Aug 6, 2019

def start(self):
""" Start the config manager and the thread to periodically fetch datafile. """
if not self.is_running:

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.

Copy link
Owner Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Need to discuss.

""" 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:

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.

self.control_flag = True
self._polling_thread.start()

def stop(self):

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.

if self.disposed:
return

self.stop()

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

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.

Copy link
Owner Author

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.

Copy link

@msohailhussain msohailhussain left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

please make changes.

Copy link
Collaborator

@mnoman09 mnoman09 left a 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.

  1. 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.
  2. Add summary.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants