Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,7 @@
import java.util.Random;
import java.util.Set;
import java.util.concurrent.ScheduledExecutorService;
import java.util.concurrent.ScheduledFuture;
import java.util.concurrent.TimeUnit;
import org.json.JSONException;
import org.json.JSONObject;
Expand Down Expand Up @@ -248,15 +249,16 @@ private void autoFetch(int remainingAttempts, long targetVersion) {

// Randomize fetch to occur between 0 - 4 seconds.
int timeTillFetch = random.nextInt(4);
scheduledExecutorService.schedule(
new Runnable() {
@Override
public void run() {
fetchLatestConfig(remainingAttempts, targetVersion);
}
},
timeTillFetch,
TimeUnit.SECONDS);
ScheduledFuture<?> unused =
scheduledExecutorService.schedule(
new Runnable() {
@Override
public void run() {
Task<Void> unused = fetchLatestConfig(remainingAttempts, targetVersion);
}
},
timeTillFetch,
TimeUnit.SECONDS);
}

@VisibleForTesting
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -57,6 +57,7 @@
import java.util.Random;
import java.util.Set;
import java.util.concurrent.ScheduledExecutorService;
import java.util.concurrent.ScheduledFuture;
import java.util.concurrent.TimeUnit;
import java.util.regex.Matcher;
import java.util.regex.Pattern;
Expand Down Expand Up @@ -381,15 +382,16 @@ private synchronized void makeRealtimeHttpConnection(long retryMilliseconds) {

if (httpRetriesRemaining > 0) {
httpRetriesRemaining--;
scheduledExecutorService.schedule(
new Runnable() {
@Override
public void run() {
beginRealtimeHttpStream();
}
},
retryMilliseconds,
TimeUnit.MILLISECONDS);
ScheduledFuture<?> unused =
scheduledExecutorService.schedule(
new Runnable() {
@Override
public void run() {
beginRealtimeHttpStream();
}
},
retryMilliseconds,
TimeUnit.MILLISECONDS);
} else if (!isInBackground) {
propagateErrors(
new FirebaseRemoteConfigClientException(
Expand Down