17
17
import { CACHE_SIZE_UNLIMITED } from '../api/database' ;
18
18
import { ListenSequence } from '../core/listen_sequence' ;
19
19
import { ListenSequenceNumber } from '../core/types' ;
20
- import { assert } from " ../util/assert" ;
20
+ import { assert } from ' ../util/assert' ;
21
21
import { AsyncQueue , TimerId } from '../util/async_queue' ;
22
22
import * as log from '../util/log' ;
23
23
import { AnyJs , primitiveComparator } from '../util/misc' ;
@@ -187,8 +187,11 @@ export class LruParams {
187
187
LruParams . DEFAULT_MAX_SEQUENCE_NUMBERS_TO_COLLECT
188
188
) ;
189
189
190
- static readonly DISABLED : LruParams =
191
- new LruParams ( LruParams . COLLECTION_DISABLED , 0 , 0 ) ;
190
+ static readonly DISABLED : LruParams = new LruParams (
191
+ LruParams . COLLECTION_DISABLED ,
192
+ 0 ,
193
+ 0
194
+ ) ;
192
195
193
196
constructor (
194
197
// When we attempt to collect, we will only do so if the cache size is greater than this
@@ -224,9 +227,13 @@ export class LruScheduler {
224
227
}
225
228
226
229
start ( ) : void {
227
- assert ( this . gcTask === null , 'Cannot start an already started LruScheduler' ) ;
230
+ assert (
231
+ this . gcTask === null ,
232
+ 'Cannot start an already started LruScheduler'
233
+ ) ;
228
234
if (
229
- this . garbageCollector . params . cacheSizeCollectionThreshold !== CACHE_SIZE_UNLIMITED
235
+ this . garbageCollector . params . cacheSizeCollectionThreshold !==
236
+ CACHE_SIZE_UNLIMITED
230
237
) {
231
238
this . scheduleGC ( ) ;
232
239
}
@@ -325,7 +332,9 @@ export class LruGarbageCollector {
325
332
txn : PersistenceTransaction ,
326
333
activeTargetIds : ActiveTargets
327
334
) : PersistencePromise < LruResults > {
328
- if ( this . params . cacheSizeCollectionThreshold === LruParams . COLLECTION_DISABLED ) {
335
+ if (
336
+ this . params . cacheSizeCollectionThreshold === LruParams . COLLECTION_DISABLED
337
+ ) {
329
338
log . debug ( 'LruGarbageCollector' , 'Garbage collection skipped; disabled' ) ;
330
339
return PersistencePromise . resolve ( GC_DID_NOT_RUN ) ;
331
340
}
@@ -335,7 +344,9 @@ export class LruGarbageCollector {
335
344
log . debug (
336
345
'LruGarbageCollector' ,
337
346
`Garbage collection skipped; Cache size ${ cacheSize } ` +
338
- `is lower than threshold ${ this . params . cacheSizeCollectionThreshold } `
347
+ `is lower than threshold ${
348
+ this . params . cacheSizeCollectionThreshold
349
+ } `
339
350
) ;
340
351
return GC_DID_NOT_RUN ;
341
352
} else {
@@ -364,9 +375,7 @@ export class LruGarbageCollector {
364
375
return this . calculateTargetCount ( txn , this . params . percentileToCollect )
365
376
. next ( sequenceNumbers => {
366
377
// Cap at the configured max
367
- if (
368
- sequenceNumbers > this . params . maximumSequenceNumbersToCollect
369
- ) {
378
+ if ( sequenceNumbers > this . params . maximumSequenceNumbersToCollect ) {
370
379
log . debug (
371
380
'LruGarbageCollector' ,
372
381
'Capping sequence numbers to collect down ' +
@@ -404,7 +413,8 @@ export class LruGarbageCollector {
404
413
removedDocumentsTs = Date . now ( ) ;
405
414
406
415
if ( log . getLogLevel ( ) <= log . LogLevel . DEBUG ) {
407
- const desc = 'LRU Garbage Collection\n' +
416
+ const desc =
417
+ 'LRU Garbage Collection\n' +
408
418
`\tCounted targets in ${ countedTargetsTs - startTs } ms\n` +
409
419
`\tDetermined least recently used ${ sequenceNumbersToCollect } in ` +
410
420
`${ foundUpperBoundTs - countedTargetsTs } ms\n` +
0 commit comments