Skip to content

Commit c2206ea

Browse files
Merge branch 'main' into update-code-annotation
2 parents 097baee + 696f021 commit c2206ea

File tree

4 files changed

+31
-18
lines changed

4 files changed

+31
-18
lines changed

firebase-config/firebase-config.gradle.kts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -85,6 +85,7 @@ dependencies {
8585
annotationProcessor(libs.autovalue)
8686
javadocClasspath(libs.autovalue.annotations)
8787
compileOnly(libs.autovalue.annotations)
88+
compileOnly(libs.errorprone.annotations)
8889
compileOnly(libs.findbugs.jsr305)
8990

9091
// Testing

firebase-config/src/main/java/com/google/firebase/remoteconfig/internal/ConfigAutoFetch.java

Lines changed: 11 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -37,6 +37,7 @@
3737
import java.util.Random;
3838
import java.util.Set;
3939
import java.util.concurrent.ScheduledExecutorService;
40+
import java.util.concurrent.ScheduledFuture;
4041
import java.util.concurrent.TimeUnit;
4142
import org.json.JSONException;
4243
import org.json.JSONObject;
@@ -248,15 +249,16 @@ private void autoFetch(int remainingAttempts, long targetVersion) {
248249

249250
// Randomize fetch to occur between 0 - 4 seconds.
250251
int timeTillFetch = random.nextInt(4);
251-
scheduledExecutorService.schedule(
252-
new Runnable() {
253-
@Override
254-
public void run() {
255-
fetchLatestConfig(remainingAttempts, targetVersion);
256-
}
257-
},
258-
timeTillFetch,
259-
TimeUnit.SECONDS);
252+
ScheduledFuture<?> unused =
253+
scheduledExecutorService.schedule(
254+
new Runnable() {
255+
@Override
256+
public void run() {
257+
Task<Void> unused = fetchLatestConfig(remainingAttempts, targetVersion);
258+
}
259+
},
260+
timeTillFetch,
261+
TimeUnit.SECONDS);
260262
}
261263

262264
@VisibleForTesting

firebase-config/src/main/java/com/google/firebase/remoteconfig/internal/ConfigContainer.java

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,7 @@
1414

1515
package com.google.firebase.remoteconfig.internal;
1616

17+
import com.google.errorprone.annotations.CanIgnoreReturnValue;
1718
import java.util.Date;
1819
import java.util.HashMap;
1920
import java.util.HashSet;
@@ -328,11 +329,13 @@ public Builder(ConfigContainer otherContainer) {
328329
this.builderRolloutMetadata = otherContainer.getRolloutMetadata();
329330
}
330331

332+
@CanIgnoreReturnValue
331333
public Builder replaceConfigsWith(Map<String, String> configsMap) {
332334
this.builderConfigsJson = new JSONObject(configsMap);
333335
return this;
334336
}
335337

338+
@CanIgnoreReturnValue
336339
public Builder replaceConfigsWith(JSONObject configsJson) {
337340
try {
338341
this.builderConfigsJson = new JSONObject(configsJson.toString());
@@ -345,11 +348,13 @@ public Builder replaceConfigsWith(JSONObject configsJson) {
345348
return this;
346349
}
347350

351+
@CanIgnoreReturnValue
348352
public Builder withFetchTime(Date fetchTime) {
349353
this.builderFetchTime = fetchTime;
350354
return this;
351355
}
352356

357+
@CanIgnoreReturnValue
353358
public Builder withAbtExperiments(JSONArray abtExperiments) {
354359
try {
355360
this.builderAbtExperiments = new JSONArray(abtExperiments.toString());
@@ -362,6 +367,7 @@ public Builder withAbtExperiments(JSONArray abtExperiments) {
362367
return this;
363368
}
364369

370+
@CanIgnoreReturnValue
365371
public Builder withPersonalizationMetadata(JSONObject personalizationMetadata) {
366372
try {
367373
this.builderPersonalizationMetadata = new JSONObject(personalizationMetadata.toString());
@@ -374,11 +380,13 @@ public Builder withPersonalizationMetadata(JSONObject personalizationMetadata) {
374380
return this;
375381
}
376382

383+
@CanIgnoreReturnValue
377384
public Builder withTemplateVersionNumber(long templateVersionNumber) {
378385
this.builderTemplateVersionNumber = templateVersionNumber;
379386
return this;
380387
}
381388

389+
@CanIgnoreReturnValue
382390
public Builder withRolloutMetadata(JSONArray rolloutMetadata) {
383391
try {
384392
this.builderRolloutMetadata = new JSONArray(rolloutMetadata.toString());

firebase-config/src/main/java/com/google/firebase/remoteconfig/internal/ConfigRealtimeHttpClient.java

Lines changed: 11 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -57,6 +57,7 @@
5757
import java.util.Random;
5858
import java.util.Set;
5959
import java.util.concurrent.ScheduledExecutorService;
60+
import java.util.concurrent.ScheduledFuture;
6061
import java.util.concurrent.TimeUnit;
6162
import java.util.regex.Matcher;
6263
import java.util.regex.Pattern;
@@ -381,15 +382,16 @@ private synchronized void makeRealtimeHttpConnection(long retryMilliseconds) {
381382

382383
if (httpRetriesRemaining > 0) {
383384
httpRetriesRemaining--;
384-
scheduledExecutorService.schedule(
385-
new Runnable() {
386-
@Override
387-
public void run() {
388-
beginRealtimeHttpStream();
389-
}
390-
},
391-
retryMilliseconds,
392-
TimeUnit.MILLISECONDS);
385+
ScheduledFuture<?> unused =
386+
scheduledExecutorService.schedule(
387+
new Runnable() {
388+
@Override
389+
public void run() {
390+
beginRealtimeHttpStream();
391+
}
392+
},
393+
retryMilliseconds,
394+
TimeUnit.MILLISECONDS);
393395
} else if (!isInBackground) {
394396
propagateErrors(
395397
new FirebaseRemoteConfigClientException(

0 commit comments

Comments
 (0)