@@ -78,6 +78,8 @@ public SplitChange fetch(long since, long sinceRBS, FetchOptions options) {
78
78
if (SPEC_VERSION .equals (SPEC_1_1 ) && (System .currentTimeMillis () - _lastProxyCheckTimestamp >= PROXY_CHECK_INTERVAL_MILLISECONDS_SS )) {
79
79
_log .info ("Switching to new Feature flag spec ({}) and fetching." , SPEC_1_3 );
80
80
SPEC_VERSION = SPEC_1_3 ;
81
+ since = -1 ;
82
+ sinceRBS = -1 ;
81
83
}
82
84
URI uri = buildURL (options , since , sinceRBS );
83
85
response = _client .get (uri , options , null );
@@ -109,38 +111,27 @@ public SplitChange fetch(long since, long sinceRBS, FetchOptions options) {
109
111
SplitChange splitChange = new SplitChange ();
110
112
if (SPEC_VERSION .equals (Spec .SPEC_1_1 )) {
111
113
splitChange .featureFlags = convertBodyToOldSpec (response .body ());
112
- splitChange .ruleBasedSegments = createEmptyDTO ();
114
+ splitChange .ruleBasedSegments = ChangeDto . createEmptyDto ();
113
115
} else {
114
116
splitChange = Json .fromJson (response .body (), SplitChange .class );
117
+ if (SPEC_VERSION .equals (Spec .SPEC_1_3 ) && _lastProxyCheckTimestamp != 0 ) {
118
+ splitChange .clearCache = true ;
119
+ _lastProxyCheckTimestamp = 0L ;
120
+ }
115
121
}
116
122
return splitChange ;
117
123
}
118
124
119
- public Long getLastProxyCheckTimestamp () {
120
- return _lastProxyCheckTimestamp ;
121
- }
122
-
123
- public void setLastProxyCheckTimestamp (long lastProxyCheckTimestamp ) {
124
- synchronized (_lock ) {
125
- _lastProxyCheckTimestamp = lastProxyCheckTimestamp ;
126
- }
127
- }
128
-
129
- private ChangeDto <RuleBasedSegment > createEmptyDTO () {
130
- ChangeDto <RuleBasedSegment > dto = new ChangeDto <>();
131
- dto .d = new ArrayList <>();
132
- dto .t = -1 ;
133
- dto .s = -1 ;
134
- return dto ;
135
- }
136
125
private ChangeDto <Split > convertBodyToOldSpec (String body ) {
137
126
return Json .fromJson (body , SplitChangesOldPayloadDto .class ).toChangeDTO ();
138
127
}
139
128
140
129
private URI buildURL (FetchOptions options , long since , long sinceRBS ) throws URISyntaxException {
141
130
URIBuilder uriBuilder = new URIBuilder (_target ).addParameter (SPEC , "" + SPEC_VERSION );
142
131
uriBuilder .addParameter (SINCE , "" + since );
143
- uriBuilder .addParameter (RB_SINCE , "" + sinceRBS );
132
+ if (SPEC_VERSION .equals (SPEC_1_3 )) {
133
+ uriBuilder .addParameter (RB_SINCE , "" + sinceRBS );
134
+ }
144
135
if (!options .flagSetsFilter ().isEmpty ()) {
145
136
uriBuilder .addParameter (SETS , "" + options .flagSetsFilter ());
146
137
}
0 commit comments