Skip to content

Commit b5881cb

Browse files
author
Greg Soltis
committed
[AUTOMATED]: Prettier Code Styling
1 parent fdeb755 commit b5881cb

File tree

2 files changed

+28
-20
lines changed

2 files changed

+28
-20
lines changed

packages/firestore/src/local/lru_garbage_collector.ts

+21-11
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@
1717
import { CACHE_SIZE_UNLIMITED } from '../api/database';
1818
import { ListenSequence } from '../core/listen_sequence';
1919
import { ListenSequenceNumber } from '../core/types';
20-
import { assert } from "../util/assert";
20+
import { assert } from '../util/assert';
2121
import { AsyncQueue, TimerId } from '../util/async_queue';
2222
import * as log from '../util/log';
2323
import { AnyJs, primitiveComparator } from '../util/misc';
@@ -187,8 +187,11 @@ export class LruParams {
187187
LruParams.DEFAULT_MAX_SEQUENCE_NUMBERS_TO_COLLECT
188188
);
189189

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+
);
192195

193196
constructor(
194197
// 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 {
224227
}
225228

226229
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+
);
228234
if (
229-
this.garbageCollector.params.cacheSizeCollectionThreshold !== CACHE_SIZE_UNLIMITED
235+
this.garbageCollector.params.cacheSizeCollectionThreshold !==
236+
CACHE_SIZE_UNLIMITED
230237
) {
231238
this.scheduleGC();
232239
}
@@ -325,7 +332,9 @@ export class LruGarbageCollector {
325332
txn: PersistenceTransaction,
326333
activeTargetIds: ActiveTargets
327334
): PersistencePromise<LruResults> {
328-
if (this.params.cacheSizeCollectionThreshold === LruParams.COLLECTION_DISABLED) {
335+
if (
336+
this.params.cacheSizeCollectionThreshold === LruParams.COLLECTION_DISABLED
337+
) {
329338
log.debug('LruGarbageCollector', 'Garbage collection skipped; disabled');
330339
return PersistencePromise.resolve(GC_DID_NOT_RUN);
331340
}
@@ -335,7 +344,9 @@ export class LruGarbageCollector {
335344
log.debug(
336345
'LruGarbageCollector',
337346
`Garbage collection skipped; Cache size ${cacheSize} ` +
338-
`is lower than threshold ${this.params.cacheSizeCollectionThreshold}`
347+
`is lower than threshold ${
348+
this.params.cacheSizeCollectionThreshold
349+
}`
339350
);
340351
return GC_DID_NOT_RUN;
341352
} else {
@@ -364,9 +375,7 @@ export class LruGarbageCollector {
364375
return this.calculateTargetCount(txn, this.params.percentileToCollect)
365376
.next(sequenceNumbers => {
366377
// Cap at the configured max
367-
if (
368-
sequenceNumbers > this.params.maximumSequenceNumbersToCollect
369-
) {
378+
if (sequenceNumbers > this.params.maximumSequenceNumbersToCollect) {
370379
log.debug(
371380
'LruGarbageCollector',
372381
'Capping sequence numbers to collect down ' +
@@ -404,7 +413,8 @@ export class LruGarbageCollector {
404413
removedDocumentsTs = Date.now();
405414

406415
if (log.getLogLevel() <= log.LogLevel.DEBUG) {
407-
const desc = 'LRU Garbage Collection\n' +
416+
const desc =
417+
'LRU Garbage Collection\n' +
408418
`\tCounted targets in ${countedTargetsTs - startTs}ms\n` +
409419
`\tDetermined least recently used ${sequenceNumbersToCollect} in ` +
410420
`${foundUpperBoundTs - countedTargetsTs}ms\n` +

packages/firestore/test/unit/local/lru_garbage_collector.test.ts

+7-9
Original file line numberDiff line numberDiff line change
@@ -30,8 +30,8 @@ import {
3030
} from '../../../src/local/lru_garbage_collector';
3131
import { MutationQueue } from '../../../src/local/mutation_queue';
3232
import {
33-
Persistence,
34-
PersistenceTransaction
33+
Persistence,
34+
PersistenceTransaction
3535
} from '../../../src/local/persistence';
3636

3737
import { PersistencePromise } from '../../../src/local/persistence_promise';
@@ -43,11 +43,11 @@ import { documentKeySet } from '../../../src/model/collections';
4343
import { Document, MaybeDocument } from '../../../src/model/document';
4444
import { DocumentKey } from '../../../src/model/document_key';
4545
import {
46-
Mutation,
47-
Precondition,
48-
SetMutation
46+
Mutation,
47+
Precondition,
48+
SetMutation
4949
} from '../../../src/model/mutation';
50-
import { AsyncQueue } from "../../../src/util/async_queue";
50+
import { AsyncQueue } from '../../../src/util/async_queue';
5151
import { path, wrapObject } from '../../util/helpers';
5252
import * as PersistenceTestHelpers from './persistence_test_helpers';
5353

@@ -101,9 +101,7 @@ function genericLruGarbageCollectorTests(
101101
params: LruParams = LruParams.DEFAULT
102102
): Promise<void> {
103103
if (persistence && persistence.started) {
104-
await queue.enqueue(() =>
105-
persistence.shutdown(/* deleteData= */ true)
106-
);
104+
await queue.enqueue(() => persistence.shutdown(/* deleteData= */ true));
107105
}
108106
lruParams = params;
109107
persistence = await newPersistence(params, queue);

0 commit comments

Comments
 (0)