Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closing the write and the watch stream after 60s of idleness #275

Merged
merged 35 commits into from
Nov 4, 2017
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
35 commits
Select commit Hold shift + click to select a range
a30f63b
Creating Stream Tests for the Web Client
schmidt-sebastian Oct 24, 2017
d47f81f
Updating comment
schmidt-sebastian Oct 24, 2017
5d4fa69
Using equal everywhere
schmidt-sebastian Oct 25, 2017
d0d40ef
Addressing review feedback
schmidt-sebastian Oct 25, 2017
4dde0a2
[AUTOMATED]: Prettier Code Styling
schmidt-sebastian Oct 25, 2017
68b04ab
Addressing feedback
schmidt-sebastian Oct 25, 2017
035a46b
Merge branch 'master' into mrschmidt-closewhenidle
schmidt-sebastian Oct 26, 2017
27c5482
Closing stream when idle
schmidt-sebastian Oct 26, 2017
2d5812e
Closing the write and the watch stream when idle
schmidt-sebastian Oct 26, 2017
8ad4df2
[AUTOMATED]: Prettier Code Styling
schmidt-sebastian Oct 27, 2017
a8a7d76
Comment fixes
schmidt-sebastian Oct 27, 2017
9b1c7bb
Addressing comments & fixing build
schmidt-sebastian Oct 30, 2017
41ab479
Refactor messaging integration test to retry test failures (#271)
jshcrowthe Oct 27, 2017
ff807ac
typo in comment (#276)
toddpress Oct 30, 2017
7c93a90
Update Package Dependencies (#270)
jshcrowthe Oct 30, 2017
c53088c
Open Source Firebase Authentication (#273)
jshcrowthe Oct 30, 2017
39972a5
Temporarily disable flakey messaging tests (@gauntface to investigate…
jshcrowthe Oct 31, 2017
c64310f
Address tests failures under Node
schmidt-sebastian Oct 31, 2017
6ea92f4
[AUTOMATED]: Prettier Code Styling
schmidt-sebastian Oct 31, 2017
5eaff05
Pin Node version to 8 (released as LTS) (#282)
jshcrowthe Oct 31, 2017
29904bb
Removing Package Lock
schmidt-sebastian Oct 31, 2017
4a73968
Using a plain array to store the handles from setTimeout()
schmidt-sebastian Oct 31, 2017
34e25a6
Add a debug script to integration/firestore (#286)
jshcrowthe Nov 1, 2017
18c0e6b
Adding new auth code owner (#288)
jshcrowthe Nov 2, 2017
808878e
Update publish scripts
jshcrowthe Nov 2, 2017
f24cd30
Publish
jshcrowthe Nov 2, 2017
f1f6611
Disable automatic integration tests (#289)
jshcrowthe Nov 2, 2017
413e296
Adds a demo app to help test and facilitate Firebase Auth API develop…
bojeil-google Nov 2, 2017
4dd1c27
fix(auth): fixes various Auth bugs. (#287)
bojeil-google Nov 3, 2017
f623c0e
Removing TestFirestore and TestQueue in favor of drain()
schmidt-sebastian Nov 3, 2017
3e3f205
[AUTOMATED]: Prettier Code Styling
schmidt-sebastian Nov 3, 2017
2951a18
Merge branch 'master' into mrschmidt-closewhenidle
schmidt-sebastian Nov 3, 2017
84c6938
Cleanup
schmidt-sebastian Nov 3, 2017
255abce
Addressing feedback
schmidt-sebastian Nov 3, 2017
7ba8832
[AUTOMATED]: Prettier Code Styling
schmidt-sebastian Nov 4, 2017
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 5 additions & 2 deletions packages/firestore/src/api/database.ts
Original file line number Diff line number Diff line change
Expand Up @@ -188,6 +188,7 @@ export class Firestore implements firestore.Firestore, FirebaseService {
// Operations on the _firestoreClient don't block on _firestoreReady. Those
// are already set to synchronize on the async queue.
private _firestoreClient: FirestoreClient | undefined;
private _queue = new AsyncQueue();
public _dataConverter: UserDataConverter;

constructor(databaseIdOrApp: FirestoreDatabase | FirebaseApp) {
Expand Down Expand Up @@ -310,7 +311,7 @@ export class Firestore implements firestore.Firestore, FirebaseService {
PlatformSupport.getPlatform(),
databaseInfo,
this._config.credentials,
new AsyncQueue()
this._queue
);
return this._firestoreClient.start(persistence);
}
Expand Down Expand Up @@ -374,7 +375,9 @@ export class Firestore implements firestore.Firestore, FirebaseService {
},
// Exposed via INTERNAL for use in tests.
disableNetwork: () => this._firestoreClient.disableNetwork(),
enableNetwork: () => this._firestoreClient.enableNetwork()
enableNetwork: () => this._firestoreClient.enableNetwork(),
drainAsyncQueue: (executeDelayedTasks: boolean) =>
this._queue.drain(executeDelayedTasks)
};

collection(pathString: string): firestore.CollectionReference {
Expand Down
6 changes: 3 additions & 3 deletions packages/firestore/src/local/local_store.ts
Original file line number Diff line number Diff line change
Expand Up @@ -582,9 +582,9 @@ export class LocalStore {

/**
* Gets the mutation batch after the passed in batchId in the mutation queue
* or null if empty.
* @param afterBatchId If provided, the batch to search after.
* @returns The next mutation or null if there wasn't one.
* or null if empty.
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thank you for fixing these things up.

* @param afterBatchId If provided, the batch to search after.
* @returns The next mutation or null if there wasn't one.
*/
nextMutationBatch(afterBatchId?: BatchId): Promise<MutationBatch | null> {
return this.persistence.runTransaction('Get next mutation batch', txn => {
Expand Down
10 changes: 2 additions & 8 deletions packages/firestore/src/remote/datastore.ts
Original file line number Diff line number Diff line change
Expand Up @@ -58,30 +58,24 @@ export class Datastore {
private initialBackoffDelay?: number
) {}

public newPersistentWriteStream(
listener: WriteStreamListener
): PersistentWriteStream {
public newPersistentWriteStream(): PersistentWriteStream {
return new PersistentWriteStream(
this.databaseInfo,
this.queue,
this.connection,
this.credentials,
this.serializer,
listener,
this.initialBackoffDelay
);
}

public newPersistentWatchStream(
listener: WatchStreamListener
): PersistentListenStream {
public newPersistentWatchStream(): PersistentListenStream {
return new PersistentListenStream(
this.databaseInfo,
this.queue,
this.connection,
this.credentials,
this.serializer,
listener,
this.initialBackoffDelay
);
}
Expand Down
Loading