Skip to content

Commit b356b2c

Browse files
committed
polishing
1 parent 0315c95 commit b356b2c

File tree

2 files changed

+11
-14
lines changed

2 files changed

+11
-14
lines changed

splitio/sync/split.py

Lines changed: 10 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -481,19 +481,16 @@ def _santizie_condition(self, split):
481481
found_all_keys_matcher = False
482482
if 'conditions' not in split or split['conditions'] is None:
483483
split['conditions'] = []
484-
conditions_count = len(split['conditions'])
485-
count = 0
486-
for condition in split['conditions']:
487-
count += 1
488-
if count == conditions_count: # checking only last condition
489-
if 'conditionType' in condition:
490-
if condition['conditionType'] == 'ROLLOUT':
491-
if 'matcherGroup' in condition:
492-
if 'matchers' in condition['matcherGroup']:
493-
for matcher in condition['matcherGroup']['matchers']:
494-
if matcher['matcherType'] == 'ALL_KEYS':
495-
found_all_keys_matcher = True
496-
break
484+
if len(split['conditions']) > 0:
485+
last_condition = split['conditions'][-1]
486+
if 'conditionType' in last_condition:
487+
if last_condition['conditionType'] == 'ROLLOUT':
488+
if 'matcherGroup' in last_condition:
489+
if 'matchers' in last_condition['matcherGroup']:
490+
for matcher in last_condition['matcherGroup']['matchers']:
491+
if matcher['matcherType'] == 'ALL_KEYS':
492+
found_all_keys_matcher = True
493+
break
497494

498495
if not found_all_keys_matcher:
499496
_LOGGER.debug("Missing default rule condition for split: %s, adding default rule with 100%% off treatment", split['name'])

splitio/sync/synchronizer.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -551,7 +551,7 @@ def synchronize_splits(self):
551551
for segment in self._split_synchronizers.split_sync.synchronize_splits():
552552
if not self._split_synchronizers.segment_sync.segment_exist_in_storage(segment):
553553
new_segments.append(segment)
554-
if len(new_segments) != 0:
554+
if len(new_segments) > 0:
555555
_LOGGER.debug('Synching Segments: %s', ','.join(new_segments))
556556
success = self._split_synchronizers.segment_sync.synchronize_segments(new_segments)
557557
if not success:

0 commit comments

Comments
 (0)