Skip to content

Commit

Permalink
Merge branch 'master' into sohail/pr-193
Browse files Browse the repository at this point in the history
  • Loading branch information
aliabbasrizvi committed Sep 16, 2019
2 parents c3d5b07 + 547a13c commit b5d461b
Show file tree
Hide file tree
Showing 3 changed files with 3 additions and 5 deletions.
4 changes: 2 additions & 2 deletions optimizely/config_manager.py
Original file line number Diff line number Diff line change
Expand Up @@ -239,8 +239,8 @@ def set_update_interval(self, update_interval):
'Invalid update_interval "{}" provided.'.format(update_interval)
)

# If polling interval is less than minimum allowed interval then set it to default update interval.
if update_interval < enums.ConfigManager.MIN_UPDATE_INTERVAL:
# If polling interval is less than or equal to 0 then set it to default update interval.
if update_interval <= 0:
self.logger.debug('update_interval value {} too small. Defaulting to {}'.format(
update_interval,
enums.ConfigManager.DEFAULT_UPDATE_INTERVAL)
Expand Down
2 changes: 0 additions & 2 deletions optimizely/helpers/enums.py
Original file line number Diff line number Diff line change
Expand Up @@ -40,8 +40,6 @@ class ConfigManager(object):
DATAFILE_URL_TEMPLATE = 'https://cdn.optimizely.com/datafiles/{sdk_key}.json'
# Default config update interval of 5 minutes
DEFAULT_UPDATE_INTERVAL = 5 * 60
# Minimum config update interval of 1 second
MIN_UPDATE_INTERVAL = 1
# Time in seconds before which request for datafile times out
REQUEST_TIMEOUT = 10

Expand Down
2 changes: 1 addition & 1 deletion tests/test_config_manager.py
Original file line number Diff line number Diff line change
Expand Up @@ -224,7 +224,7 @@ def test_set_update_interval(self, _):
project_config_manager.set_update_interval('invalid interval')

# Assert that update_interval cannot be set to less than allowed minimum and instead is set to default value.
project_config_manager.set_update_interval(0.42)
project_config_manager.set_update_interval(-4.2)
self.assertEqual(enums.ConfigManager.DEFAULT_UPDATE_INTERVAL, project_config_manager.update_interval)

# Assert that if no update_interval is provided, it is set to default value.
Expand Down

0 comments on commit b5d461b

Please sign in to comment.