Skip to content

Commit 4697d40

Browse files
authored
chore(firestore): avoid starting GC scheduler if GC is disabled (#8058)
This change avoids starting the GC scheduler if garbage collection is disabled (i.e., when the cache size is set to unlimited).
1 parent c663292 commit 4697d40

1 file changed

Lines changed: 4 additions & 1 deletion

File tree

firebase-firestore/src/main/java/com/google/firebase/firestore/core/FirestoreClient.java

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -26,6 +26,7 @@
2626
import com.google.firebase.firestore.EventListener;
2727
import com.google.firebase.firestore.FirebaseFirestoreException;
2828
import com.google.firebase.firestore.FirebaseFirestoreException.Code;
29+
import com.google.firebase.firestore.FirebaseFirestoreSettings;
2930
import com.google.firebase.firestore.LoadBundleTask;
3031
import com.google.firebase.firestore.PipelineResultObserver;
3132
import com.google.firebase.firestore.TransactionOptions;
@@ -296,7 +297,9 @@ private void initialize(
296297
eventManager = provider.getEventManager();
297298
IndexBackfiller indexBackfiller = provider.getIndexBackfiller();
298299

299-
if (gcScheduler != null) {
300+
if (gcScheduler != null
301+
&& provider.settings.getCacheSizeBytes()
302+
!= FirebaseFirestoreSettings.CACHE_SIZE_UNLIMITED) {
300303
gcScheduler.start();
301304
}
302305

0 commit comments

Comments
 (0)