@@ -78,6 +78,8 @@ public SplitChange fetch(long since, long sinceRBS, FetchOptions options) {
7878 if (SPEC_VERSION .equals (SPEC_1_1 ) && (System .currentTimeMillis () - _lastProxyCheckTimestamp >= PROXY_CHECK_INTERVAL_MILLISECONDS_SS )) {
7979 _log .info ("Switching to new Feature flag spec ({}) and fetching." , SPEC_1_3 );
8080 SPEC_VERSION = SPEC_1_3 ;
81+ since = -1 ;
82+ sinceRBS = -1 ;
8183 }
8284 URI uri = buildURL (options , since , sinceRBS );
8385 response = _client .get (uri , options , null );
@@ -109,38 +111,27 @@ public SplitChange fetch(long since, long sinceRBS, FetchOptions options) {
109111 SplitChange splitChange = new SplitChange ();
110112 if (SPEC_VERSION .equals (Spec .SPEC_1_1 )) {
111113 splitChange .featureFlags = convertBodyToOldSpec (response .body ());
112- splitChange .ruleBasedSegments = createEmptyDTO ();
114+ splitChange .ruleBasedSegments = ChangeDto . createEmptyDto ();
113115 } else {
114116 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+ }
115121 }
116122 return splitChange ;
117123 }
118124
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- }
136125 private ChangeDto <Split > convertBodyToOldSpec (String body ) {
137126 return Json .fromJson (body , SplitChangesOldPayloadDto .class ).toChangeDTO ();
138127 }
139128
140129 private URI buildURL (FetchOptions options , long since , long sinceRBS ) throws URISyntaxException {
141130 URIBuilder uriBuilder = new URIBuilder (_target ).addParameter (SPEC , "" + SPEC_VERSION );
142131 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+ }
144135 if (!options .flagSetsFilter ().isEmpty ()) {
145136 uriBuilder .addParameter (SETS , "" + options .flagSetsFilter ());
146137 }
0 commit comments