Thanks to visit codestin.com
Credit goes to github.com

Skip to content
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
make update interval small
  • Loading branch information
oakbani committed Sep 18, 2019
commit daafa4be864bd6e8ee01925c2c35299d9a4199b1
1 change: 1 addition & 0 deletions optimizely/config_manager.py
Original file line number Diff line number Diff line change
Expand Up @@ -299,6 +299,7 @@ def _run(self):
try:
while self.is_running:
self.fetch_datafile()
self.logger.debug("This thread is running")
time.sleep(self.update_interval)
except (OSError, OverflowError) as err:
self.logger.error('Error in time.sleep. '
Expand Down
7 changes: 4 additions & 3 deletions tests/test_config_manager.py
Original file line number Diff line number Diff line change
Expand Up @@ -282,11 +282,12 @@ def test_is_running(self, _):
blocking_queue = queue.Queue()
with mock.patch('optimizely.config_manager.PollingConfigManager.fetch_datafile',
side_effect=lambda: blocking_queue.put_nowait('fetch_datafile called')) as mock_fetch_datafile:
project_config_manager = config_manager.PollingConfigManager(sdk_key='some_key')
project_config_manager = config_manager.PollingConfigManager(
sdk_key='some_key', update_interval=1)

self.assertTrue(project_config_manager.is_running)
# Wait for 10 seconds before asserting mock
# Wait for 5 seconds before asserting mock
try:
blocking_queue.get(True, 10)
blocking_queue.get(True, 5)
except queue.Empty:
mock_fetch_datafile.assert_called_with()