Skip to content

Commit 3479f61

Browse files
committed
Merge fix
1 parent 89e00af commit 3479f61

2 files changed

Lines changed: 3 additions & 4 deletions

File tree

src/main/java/com/configcat/ConfigFetcher.java

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -223,8 +223,8 @@ private CompletableFuture<FetchResponse> fetchWithRetryAsync(final String eTag)
223223
return this.getResponseAsync(eTag, requestId).thenComposeAsync(response -> {
224224
if (response.shouldRetry()) {
225225
try {
226-
long now = System.currentTimeMillis();
227-
if (lastEvictAllTimestamp == 0 || (now - lastEvictAllTimestamp) >= EVICT_ALL_THRESHOLD_NS) {
226+
long now = System.nanoTime();
227+
if (lastEvictAllTimestamp == Long.MIN_VALUE || (now - lastEvictAllTimestamp) >= EVICT_ALL_THRESHOLD_NS) {
228228
this.httpClient.connectionPool().evictAll();
229229
lastEvictAllTimestamp = now;
230230
if (isDebugLoggingEnabled){

src/test/java/com/configcat/ConfigFetcherTest.java

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,6 @@
2020
import java.lang.reflect.Method;
2121
import java.net.InetSocketAddress;
2222
import java.net.Proxy;
23-
import java.lang.reflect.Field;
2423
import java.util.concurrent.ExecutionException;
2524
import java.util.concurrent.TimeUnit;
2625
import java.util.stream.Stream;
@@ -435,7 +434,7 @@ public void evictAllThrottledWithin30Seconds() throws Exception {
435434
"", this.server.url("/").toString(), false, PollingModes.manualPoll().getPollingIdentifier());
436435

437436
// First fetch: evictAll should be called, timestamp set
438-
assertEquals(0, getLastEvictAllTimestampWithReflection(fetcher));
437+
assertEquals(Long.MIN_VALUE, getLastEvictAllTimestampWithReflection(fetcher));
439438
FetchResponse response1 = fetcher.fetchAsync(null).get();
440439
assertTrue(response1.isFetched());
441440
long firstTimestamp = getLastEvictAllTimestampWithReflection(fetcher);

0 commit comments

Comments
 (0)