Skip to content

Commit 0ee99d5

Browse files
Merge 01e6ee8 into 3ccd70a
2 parents 3ccd70a + 01e6ee8 commit 0ee99d5

File tree

1 file changed

+13
-5
lines changed

1 file changed

+13
-5
lines changed

packages/firestore/src/local/lru_garbage_collector.ts

+13-5
Original file line numberDiff line numberDiff line change
@@ -32,6 +32,8 @@ import {
3232
import { PersistencePromise } from './persistence_promise';
3333
import { TargetData } from './target_data';
3434

35+
const LOG_TAG = 'LruGarbageCollector';
36+
3537
/**
3638
* Persistence layers intending to use LRU Garbage collection should have reference delegates that
3739
* implement this interface. This interface defines the operations that the LRU garbage collector
@@ -265,13 +267,19 @@ export class LruScheduler implements GarbageCollectionScheduler {
265267
this.gcTask = this.asyncQueue.enqueueAfterDelay(
266268
TimerId.LruGarbageCollection,
267269
delay,
268-
() => {
270+
async () => {
269271
this.gcTask = null;
270272
this.hasRun = true;
271-
return localStore
272-
.collectGarbage(this.garbageCollector)
273-
.then(() => this.scheduleGC(localStore))
274-
.catch(ignoreIfPrimaryLeaseLoss);
273+
try {
274+
await localStore.collectGarbage(this.garbageCollector);
275+
} catch (e) {
276+
if (e.name === 'IndexedDbTransactionError') {
277+
logDebug(LOG_TAG, 'Ignoring IndexedDB error during garbage collection: ', e);
278+
} else {
279+
await ignoreIfPrimaryLeaseLoss(e);
280+
}
281+
}
282+
await this.scheduleGC(localStore);
275283
}
276284
);
277285
}

0 commit comments

Comments
 (0)