File tree 1 file changed +13
-5
lines changed
packages/firestore/src/local
1 file changed +13
-5
lines changed Original file line number Diff line number Diff line change @@ -32,6 +32,8 @@ import {
32
32
import { PersistencePromise } from './persistence_promise' ;
33
33
import { TargetData } from './target_data' ;
34
34
35
+ const LOG_TAG = 'LruGarbageCollector' ;
36
+
35
37
/**
36
38
* Persistence layers intending to use LRU Garbage collection should have reference delegates that
37
39
* implement this interface. This interface defines the operations that the LRU garbage collector
@@ -265,13 +267,19 @@ export class LruScheduler implements GarbageCollectionScheduler {
265
267
this . gcTask = this . asyncQueue . enqueueAfterDelay (
266
268
TimerId . LruGarbageCollection ,
267
269
delay ,
268
- ( ) => {
270
+ async ( ) => {
269
271
this . gcTask = null ;
270
272
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 ) ;
275
283
}
276
284
) ;
277
285
}
You can’t perform that action at this time.
0 commit comments