Skip to content

Commit d4f3377

Browse files
committed
Used private var for retry attempts
1 parent ddb9201 commit d4f3377

File tree

3 files changed

+6
-6
lines changed

3 files changed

+6
-6
lines changed

splitio/sync/manager.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@
1515
class Manager(object): # pylint:disable=too-many-instance-attributes
1616
"""Manager Class."""
1717

18-
SYNC_ALL_ATTEMPTS = -1
18+
_SYNC_ALL_ATTEMPTS = -1
1919
_CENTINEL_EVENT = object()
2020

2121
def __init__(self, ready_flag, synchronizer, auth_api, streaming_enabled, sdk_metadata, sse_url=None, client_key=None): # pylint:disable=too-many-arguments
@@ -67,7 +67,7 @@ def start(self):
6767
:type max_retry_attempts: int
6868
"""
6969
try:
70-
self._synchronizer.sync_all(self.SYNC_ALL_ATTEMPTS)
70+
self._synchronizer.sync_all(self._SYNC_ALL_ATTEMPTS)
7171
self._ready_flag.set()
7272
self._synchronizer.start_periodic_data_recording()
7373
if self._streaming_enabled:

splitio/sync/synchronizer.py

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -304,7 +304,7 @@ def sync_all(self, max_retry_attempts=-1):
304304
try:
305305
if not self.synchronize_splits(None, False):
306306
retry_attempts = self._retry_block(max_retry_attempts, retry_attempts)
307-
if not max_retry_attempts == -1 and retry_attempts == -1:
307+
if max_retry_attempts != -1 and retry_attempts == -1:
308308
break
309309
continue
310310

@@ -318,14 +318,14 @@ def sync_all(self, max_retry_attempts=-1):
318318
_LOGGER.error("Exception caught when trying to sync all data: %s", str(exc))
319319
_LOGGER.debug('Error: ', exc_info=True)
320320
retry_attempts = self._retry_block(max_retry_attempts, retry_attempts)
321-
if not max_retry_attempts == -1 and retry_attempts == -1:
321+
if max_retry_attempts != -1 and retry_attempts == -1:
322322
break
323323
continue
324324

325325
_LOGGER.error("Could not correctly synchronize splits and segments after %d attempts.", retry_attempts)
326326

327327
def _retry_block(self, max_retry_attempts, retry_attempts):
328-
if not max_retry_attempts == -1:
328+
if max_retry_attempts != -1:
329329
retry_attempts += 1
330330
if retry_attempts > max_retry_attempts:
331331
return -1

tests/sync/test_manager.py

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

48-
manager.SYNC_ALL_ATTEMPTS = 1
48+
manager._SYNC_ALL_ATTEMPTS = 1
4949
manager.start() # should not throw!
5050

5151
def test_start_streaming_false(self, mocker):

0 commit comments

Comments
 (0)