Skip to content

Commit 547a13c

Browse files
oakbanimjc1283
authored andcommitted
update: update polling interval. (#209)
Replica of #208
1 parent 96b4d55 commit 547a13c

File tree

3 files changed

+3
-5
lines changed

3 files changed

+3
-5
lines changed

optimizely/config_manager.py

+2-2
Original file line numberDiff line numberDiff line change
@@ -239,8 +239,8 @@ def set_update_interval(self, update_interval):
239239
'Invalid update_interval "{}" provided.'.format(update_interval)
240240
)
241241

242-
# If polling interval is less than minimum allowed interval then set it to default update interval.
243-
if update_interval < enums.ConfigManager.MIN_UPDATE_INTERVAL:
242+
# If polling interval is less than or equal to 0 then set it to default update interval.
243+
if update_interval <= 0:
244244
self.logger.debug('update_interval value {} too small. Defaulting to {}'.format(
245245
update_interval,
246246
enums.ConfigManager.DEFAULT_UPDATE_INTERVAL)

optimizely/helpers/enums.py

-2
Original file line numberDiff line numberDiff line change
@@ -40,8 +40,6 @@ class ConfigManager(object):
4040
DATAFILE_URL_TEMPLATE = 'https://cdn.optimizely.com/datafiles/{sdk_key}.json'
4141
# Default config update interval of 5 minutes
4242
DEFAULT_UPDATE_INTERVAL = 5 * 60
43-
# Minimum config update interval of 1 second
44-
MIN_UPDATE_INTERVAL = 1
4543
# Time in seconds before which request for datafile times out
4644
REQUEST_TIMEOUT = 10
4745

tests/test_config_manager.py

+1-1
Original file line numberDiff line numberDiff line change
@@ -224,7 +224,7 @@ def test_set_update_interval(self, _):
224224
project_config_manager.set_update_interval('invalid interval')
225225

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

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

0 commit comments

Comments
 (0)