-
Notifications
You must be signed in to change notification settings - Fork 939
Enable no-floating-promises lint check and fix / suppress violations. #1087
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
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -396,6 +396,7 @@ export class IndexedDbPersistence implements Persistence { | |
|
||
// Attempt graceful shutdown (including releasing our owner lease), but | ||
// there's no guarantee it will complete. | ||
// tslint:disable-next-line:no-floating-promises | ||
this.shutdown(); | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. This runs on the queue in the multi-tab branch. Should we change it here to also use This code is somewhat untested and I am a little afraid of its raciness if we don't enqueue it. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I tried but we don't have access to the async queue here right now. Maybe you should get around to merging multi-tab. 😛 |
||
}; | ||
window.addEventListener('unload', this.windowUnloadHandler); | ||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -144,10 +144,10 @@ describe('Watch Stream', () => { | |
watchStream = ds.newPersistentWatchStream(streamListener); | ||
watchStream.start(); | ||
|
||
return streamListener.awaitCallback('open').then(() => { | ||
watchStream.stop(); | ||
return streamListener.awaitCallback('open').then(async () => { | ||
await watchStream.stop(); | ||
|
||
return streamListener.awaitCallback('close'); | ||
await streamListener.awaitCallback('close'); | ||
}); | ||
}); | ||
}); | ||
|
@@ -193,10 +193,10 @@ describe('Write Stream', () => { | |
writeStream = ds.newPersistentWriteStream(streamListener); | ||
writeStream.start(); | ||
return streamListener.awaitCallback('open'); | ||
}).then(() => { | ||
writeStream.stop(); | ||
}).then(async () => { | ||
await writeStream.stop(); | ||
|
||
return streamListener.awaitCallback('close'); | ||
await streamListener.awaitCallback('close'); | ||
}); | ||
}); | ||
|
||
|
@@ -221,10 +221,10 @@ describe('Write Stream', () => { | |
writeStream.writeMutations(SINGLE_MUTATION); | ||
return streamListener.awaitCallback('mutationResult'); | ||
}) | ||
.then(() => { | ||
writeStream.stop(); | ||
.then(async () => { | ||
await writeStream.stop(); | ||
|
||
return streamListener.awaitCallback('close'); | ||
await streamListener.awaitCallback('close'); | ||
}); | ||
}); | ||
|
||
|
@@ -295,9 +295,11 @@ describe('Write Stream', () => { | |
.then(() => { | ||
// Simulate callback from GRPC with an unauthenticated error -- this should invalidate | ||
// the token. | ||
writeStream.handleStreamClose( | ||
return writeStream.handleStreamClose( | ||
new FirestoreError(Code.UNAUTHENTICATED, '') | ||
); | ||
}) | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Is there a reason you added the extra There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Yes. If I changed this then() callback to async/await then I'd feel compelled to convert the whole test, and then I'd feel compelled to convert the whole file, and at that point I may as well go ahead and convert the rest of our codebase. At that point I'd be so good at it I might as well start tackling other open source projects. And then I'd never get anything done. |
||
.then(() => { | ||
return streamListener.awaitCallback('close'); | ||
}) | ||
.then(() => { | ||
|
@@ -306,9 +308,11 @@ describe('Write Stream', () => { | |
}) | ||
.then(() => { | ||
// Simulate a different error -- token should not be invalidated this time. | ||
writeStream.handleStreamClose( | ||
return writeStream.handleStreamClose( | ||
new FirestoreError(Code.UNAVAILABLE, '') | ||
); | ||
}) | ||
.then(() => { | ||
return streamListener.awaitCallback('close'); | ||
}) | ||
.then(() => { | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Could syncEngine hide this Deferred?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Not quite. The spec tests need to be able to wait for the write() to complete locally without waiting for the user callback (after the server ack of the write). So there are two separate async things you might want to wait on.