Skip to content

Commit f36a9da

Browse files
Lint/Prettier
1 parent 547085a commit f36a9da

File tree

4 files changed

+28
-36
lines changed

4 files changed

+28
-36
lines changed

packages/firestore/src/local/indexeddb_schema.ts

Lines changed: 28 additions & 33 deletions
Original file line numberDiff line numberDiff line change
@@ -134,40 +134,35 @@ export class SchemaConverter implements SimpleDbSchemaConverter {
134134

135135
const indexedDbTransaction = new IndexedDbTransaction(txn);
136136
return queuesStore.loadAll().next(queues => {
137-
let p = PersistencePromise.resolve();
138-
for (const queue of queues) {
139-
p = p.next(() => {
140-
const mutationQueue = new IndexedDbMutationQueue(
141-
queue.userId,
142-
this.serializer
137+
return PersistencePromise.forEach(queues, queue => {
138+
const mutationQueue = new IndexedDbMutationQueue(
139+
queue.userId,
140+
this.serializer
141+
);
142+
const range = IDBKeyRange.bound(
143+
[queue.userId, BATCHID_UNKNOWN],
144+
[queue.userId, queue.lastAcknowledgedBatchId]
145+
);
146+
147+
return mutationsStore
148+
.loadAll(DbMutationBatch.userMutationsIndex, range)
149+
.next(dbBatches => {
150+
return PersistencePromise.forEach(dbBatches, dbBatch => {
151+
assert(
152+
dbBatch.userId === queue.userId,
153+
`Cannot process batch ${dbBatch.batchId} from unexpected user`
154+
);
155+
const batch = this.serializer.fromDbMutationBatch(dbBatch);
156+
return mutationQueue.removeMutationBatch(
157+
indexedDbTransaction,
158+
batch
159+
);
160+
});
161+
})
162+
.next(() =>
163+
mutationQueue.performConsistencyCheck(indexedDbTransaction)
143164
);
144-
const range = IDBKeyRange.bound(
145-
[queue.userId, BATCHID_UNKNOWN],
146-
[queue.userId, queue.lastAcknowledgedBatchId]
147-
);
148-
149-
return mutationsStore
150-
.loadAll(DbMutationBatch.userMutationsIndex, range)
151-
.next(dbBatches => {
152-
let removeP = PersistencePromise.resolve();
153-
for (const dbBatch of dbBatches) {
154-
assert(
155-
dbBatch.userId === queue.userId,
156-
`Cannot process batch ${dbBatch.batchId} from unexpected user`
157-
);
158-
const batch = this.serializer.fromDbMutationBatch(dbBatch);
159-
removeP = removeP.next(() =>
160-
mutationQueue.removeMutationBatch(indexedDbTransaction, batch)
161-
);
162-
}
163-
return removeP;
164-
})
165-
.next(() =>
166-
mutationQueue.performConsistencyCheck(indexedDbTransaction)
167-
);
168-
});
169-
}
170-
return p;
165+
});
171166
});
172167
}
173168
}

packages/firestore/src/local/simple_db.ts

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,6 @@ import { SCHEMA_VERSION } from './indexeddb_schema';
2222
import { AnyJs } from '../util/misc';
2323
import { Deferred } from '../util/promise';
2424
import { Code, FirestoreError } from '../util/error';
25-
import { DatabaseId } from '../core/database_info';
2625

2726
const LOG_TAG = 'SimpleDb';
2827

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

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,6 @@ import {
2525
} from '../../../src/local/simple_db';
2626
import { ResourcePath } from '../../../src/model/path';
2727
import { path } from '../../util/helpers';
28-
import { INDEXEDDB_TEST_DATABASE_ID } from './persistence_test_helpers';
2928

3029
let db: SimpleDb;
3130
const sep = '\u0001\u0001';

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

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,6 @@ import {
2828
SimpleDbStore,
2929
SimpleDbTransaction
3030
} from '../../../src/local/simple_db';
31-
import { DatabaseId } from '../../../src/core/database_info';
3231

3332
chai.use(chaiAsPromised);
3433

0 commit comments

Comments
 (0)