Skip to content

Commit 51e63ae

Browse files
committed
ensure syncall does not throw an exception
1 parent 8ab97c1 commit 51e63ae

5 files changed

Lines changed: 14 additions & 12 deletions

File tree

CHANGES.txt

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,6 @@
1+
8.3.1 (TBD)
2+
- Fixed error handling when split server fails, so that it doesn't bring streaming down.
3+
14
8.3.0 (Nov 4, 2020)
25
- Added local impressions deduping. Defaulting to optimized
36
- Added support for the new Split streaming architecture. When enabled (default), the SDK will not poll for updates but instead receive notifications every time there's a change in your environments, allowing to process those much quicker. If disabled or in the event of an issue, the SDK will fallback to the known polling mechanism to provide a seamless experience.

splitio/sync/synchronizer.py

Lines changed: 6 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -251,12 +251,13 @@ def sync_all(self):
251251
"""Synchronize all split data."""
252252
try:
253253
self.synchronize_splits(None)
254-
if not self._synchronize_segments():
255-
_LOGGER.error('Failed syncing segments')
256-
raise RuntimeError('Failed syncing segments')
257-
except APIException as exc:
254+
except APIException:
258255
_LOGGER.error('Failed syncing splits')
259-
raise_from(APIException('Failed to sync splits'), exc)
256+
_LOGGER.debug('Error: ', exc_info=True)
257+
258+
if not self._synchronize_segments():
259+
_LOGGER.error('Failed syncing segments')
260+
_LOGGER.debug('Error: ', exc_info=True)
260261

261262
def shutdown(self, blocking):
262263
"""

splitio/version.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
__version__ = '8.3.0'
1+
__version__ = '8.3.1-rc1'

tests/sync/test_manager.py

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -45,8 +45,7 @@ def run(x):
4545
synchronizer = Synchronizer(synchronizers, split_tasks)
4646
manager = Manager(threading.Event(), synchronizer, mocker.Mock(), False)
4747

48-
with pytest.raises(APIException):
49-
manager.start()
48+
manager.start() # should not throw!
5049

5150
def test_start_streaming_false(self, mocker):
5251
splits_ready_event = threading.Event()

tests/sync/test_synchronizer.py

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -35,8 +35,8 @@ def run(x):
3535

3636
with pytest.raises(APIException):
3737
sychronizer.synchronize_splits(None)
38-
with pytest.raises(APIException):
39-
sychronizer.sync_all()
38+
39+
sychronizer.sync_all() # sync_all should not throw!
4040

4141
def test_sync_all_failed_segments(self, mocker):
4242
api = mocker.Mock()
@@ -55,8 +55,7 @@ def run(x, y):
5555
mocker.Mock(), mocker.Mock(), mocker.Mock())
5656
sychronizer = Synchronizer(split_synchronizers, mocker.Mock(spec=SplitTasks))
5757

58-
with pytest.raises(RuntimeError):
59-
sychronizer.sync_all()
58+
sychronizer.sync_all() # SyncAll should not throw!
6059
assert not sychronizer._synchronize_segments()
6160

6261
splits = [{

0 commit comments

Comments
 (0)