-
Notifications
You must be signed in to change notification settings - Fork 875
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
Allow user to unlisten to queries after shutdown. #2083
Conversation
@@ -536,7 +536,6 @@ export class FirestoreClient { | |||
} | |||
|
|||
unlisten(listener: QueryListener): void { | |||
this.verifyNotShutdown(); | |||
this.asyncQueue.enqueueAndForget(() => { |
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.
This potentially calls into the SyncEngine. I wonder if we should guard this on the shutdown state and not call unlisten
if we are shut down?
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.
Done.
@@ -536,7 +536,10 @@ export class FirestoreClient { | |||
} | |||
|
|||
unlisten(listener: QueryListener): void { | |||
this.verifyNotShutdown(); | |||
// Make unlisten a no-op if client is shut down. |
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.
Your code is so clear that I think we can remove this comment :)
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.
I actually want to keep it. The reason is FirestoreClient
methods generally run verifyNotShutdown
before doing anything. This one deviate from that.
I updated the comment to be more clear.
@@ -536,7 +536,10 @@ export class FirestoreClient { | |||
} | |||
|
|||
unlisten(listener: QueryListener): void { | |||
this.verifyNotShutdown(); | |||
// Make unlisten a no-op if client is shut down. | |||
if(this.clientShutdown) { |
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.
There is something going on with your formatter. This should be if (this.clientShutdown)
I would also slightly prefer if you wrote the inverse and removed the early return. Optional.
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.
Yeah, it's strange, the automated prettier commit did not make into the push somehow..
No description provided.