Skip to content

Commit 06d47e4

Browse files
committed
polish
1 parent 368830a commit 06d47e4

File tree

2 files changed

+9
-10
lines changed

2 files changed

+9
-10
lines changed

client/src/main/java/io/split/engine/experiments/RuleBasedSegmentParser.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -41,7 +41,7 @@ private ParsedRuleBasedSegment parseWithoutExceptionHandling(RuleBasedSegment ru
4141
break;
4242
}
4343
CombiningMatcher matcher = toMatcher(condition.matcherGroup);
44-
parsedConditionList.add(new ParsedCondition(condition.conditionType, matcher, partitions, condition.label));
44+
parsedConditionList.add(new ParsedCondition(condition.conditionType, matcher, null, condition.label));
4545
}
4646

4747
return new ParsedRuleBasedSegment(

client/src/main/java/io/split/engine/experiments/SplitFetcherImp.java

Lines changed: 8 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,8 @@
11
package io.split.engine.experiments;
22

3+
import io.split.client.dtos.ChangeDto;
4+
import io.split.client.dtos.RuleBasedSegment;
5+
import io.split.client.dtos.Split;
36
import io.split.client.dtos.SplitChange;
47
import io.split.client.exceptions.UriTooLongException;
58
import io.split.client.interceptors.FlagSetsFilter;
@@ -121,7 +124,7 @@ private Set<String> runWithoutExceptionHandling(FetchOptions options) throws Int
121124
throw new IllegalStateException("SplitChange was null");
122125
}
123126

124-
if (checkExitConditions(change.featureFlags, _splitCacheProducer.getChangeNumber()) &&
127+
if (checkExitConditions(change.featureFlags, _splitCacheProducer.getChangeNumber()) ||
125128
checkExitConditions(change.ruleBasedSegments, _ruleBasedSegmentCacheProducer.getChangeNumber())) {
126129
return segments;
127130
}
@@ -137,11 +140,12 @@ private Set<String> runWithoutExceptionHandling(FetchOptions options) throws Int
137140
if (change.featureFlags.d.isEmpty() && change.ruleBasedSegments.d.isEmpty()) {
138141
return segments;
139142
}
140-
}
143+
141144

142145
synchronized (_lock) {
143146
// check state one more time.
144-
if (checkReturnConditions(change)) {
147+
if (checkExitConditions(change.featureFlags, _splitCacheProducer.getChangeNumber()) &&
148+
checkExitConditions(change.ruleBasedSegments, _ruleBasedSegmentCacheProducer.getChangeNumber())) {
145149
// some other thread may have updated the shared state. exit
146150
return segments;
147151
}
@@ -156,16 +160,11 @@ private Set<String> runWithoutExceptionHandling(FetchOptions options) throws Int
156160
ruleBasedSegmentsToUpdate.getToRemove(), change.ruleBasedSegments.t);
157161
_telemetryRuntimeProducer.recordSuccessfulSync(LastSynchronizationRecordsEnum.SPLITS, System.currentTimeMillis());
158162
}
163+
159164
return segments;
160165
}
161166

162167
private <T> boolean checkExitConditions(ChangeDto<T> change, long cn) {
163168
return change.s != cn || change.t < cn;
164169
}
165-
166-
private boolean checkReturnConditions(SplitChange change) {
167-
return ((change.featureFlags.s != _splitCacheProducer.getChangeNumber() || change.featureFlags.t < _splitCacheProducer.getChangeNumber()) &&
168-
(change.ruleBasedSegments.s != _ruleBasedSegmentCacheProducer.getChangeNumber() ||
169-
change.ruleBasedSegments.t < _ruleBasedSegmentCacheProducer.getChangeNumber()));
170-
}
171170
}

0 commit comments

Comments
 (0)