Skip to content

Commit 84c6938

Browse files
Cleanup
1 parent 2951a18 commit 84c6938

File tree

6 files changed

+9
-73
lines changed

6 files changed

+9
-73
lines changed

packages/firestore/src/remote/persistent_stream.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -255,7 +255,7 @@ export abstract class PersistentStream<
255255
return this.handleIdleCloseTimer();
256256
}, IDLE_TIMEOUT_MS)
257257
.catch((err: FirestoreError) => {
258-
// When the AsyncQueue gets drained during a shutdown, pending Promises
258+
// When the AsyncQueue gets drained during testing, pending Promises
259259
// (including these idle checks) will get rejected. We special-case
260260
// these cancelled idle checks to make sure that these specific Promise
261261
// rejections are not considered unhandled.

packages/firestore/src/remote/remote_store.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -708,8 +708,8 @@ export class RemoteStore {
708708
'onWriteStreamClose() should only be called when the network is enabled'
709709
);
710710

711-
// If the write stream closed due to an error, invoke the error callbacks if there are pending
712-
// writes.
711+
// If the write stream closed due to an error, invoke the error callbacks if
712+
// there are pending writes.
713713
if (error && this.pendingWrites.length > 0) {
714714
assert(
715715
!!error,

packages/firestore/src/util/async_queue.ts

Lines changed: 4 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -32,9 +32,9 @@ export class AsyncQueue {
3232
private tail: Promise<AnyJs | void> = Promise.resolve();
3333

3434
// A list with timeout handles and their respective deferred promises.
35-
// Contains an entry for each operation that is queued to run future (i.e. it
36-
// has a delay that has not yet elapsed). Prior to cleanup, this list may also
37-
// contain entries that have already been run (in which case `handle` is
35+
// Contains an entry for each operation that is queued to run in the future
36+
// (i.e. it has a delay that has not yet elapsed). Prior to cleanup, this list
37+
// may also contain entries that have already been run (in which case `handle` is
3838
// null).
3939
//
4040
// tslint:disable-next-line:no-any Accept any type of delayed operation.
@@ -127,8 +127,6 @@ export class AsyncQueue {
127127
/**
128128
* Waits until all currently scheduled tasks are finished executing. Tasks
129129
* schedule with a delay can be rejected or queued for immediate execution.
130-
*
131-
* @param executeDelayedTasks
132130
*/
133131
drain(executeDelayedTasks: boolean): Promise<void> {
134132
this.delayedOperations.forEach(entry => {
@@ -150,6 +148,7 @@ export class AsyncQueue {
150148
}
151149
});
152150
this.delayedOperations = [];
151+
this.delayedOperationsCount = 0;
153152
return this.schedule(() => Promise.resolve());
154153
}
155154
}

packages/firestore/test/integration/api/database.test.ts

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@ import { expect } from 'chai';
1818
import * as firestore from 'firestore';
1919

2020
import { Deferred } from '../../../src/util/promise';
21-
import { asyncIt, fasyncIt } from '../../util/helpers';
21+
import { asyncIt } from '../../util/helpers';
2222
import firebase from '../util/firebase_export';
2323
import {
2424
apiDescribe,
@@ -632,7 +632,6 @@ apiDescribe('Database', persistence => {
632632
return docRef
633633
.set({ foo: 'bar' })
634634
.then(() => {
635-
console.log(JSON.stringify(queue));
636635
expect(queue.delayedOperationsCount).to.be.equal(1);
637636
return queue.drain(/* executeDelayedTasks= */ true);
638637
})

packages/firestore/test/integration/remote/stream.test.ts

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -30,9 +30,8 @@ import {
3030
} from '../../../src/remote/watch_change';
3131
import { AsyncQueue } from '../../../src/util/async_queue';
3232
import { Deferred } from '../../../src/util/promise';
33-
import { asyncIt, fasyncIt, setMutation } from '../../util/helpers';
33+
import { asyncIt, setMutation } from '../../util/helpers';
3434
import { withTestDatastore } from '../util/helpers';
35-
import { TestQueue } from '../util/test_queue';
3635

3736
/**
3837
* StreamEventType combines the events that can be observed by the

packages/firestore/test/integration/util/test_queue.ts

Lines changed: 0 additions & 61 deletions
This file was deleted.

0 commit comments

Comments
 (0)