-
Notifications
You must be signed in to change notification settings - Fork 66
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 clients to cancel ApiStreamObserver early #1587
Comments
Hi @mdietrichstein. You mention that this issue is "similar" to #574. But, to me, it looks identical. Could you highlight what the difference is? We do indeed have this feature request in our backlog (to add cancellation support to query.stream()) but we have not prioritized its work at the moment. |
Hi @dconeybe You're right, the issue is actually identical. It's great to hear that this feature is on your backlog. I'm open to contributing by implementing the feature myself and submitting a pull request. If you could provide some guidance or point me in the right direction, I'd be willing to take on the task if this is in your interest as well. Let me know how I can be of assistance in moving this forward. |
Hi @mdietrichstein. Thanks for your offer to author a pull request for this feature. That is definitely something we'd be open to. Still, I don't personally have the time to devote to the code review process, but I'll check with my team and see if I can find someone who does. Regardless, you are welcome to open a pull request, even if it remains unreviewed for some time. One thing to note is that the pull request will include changes to the public API. That's fine, but we have extra internal review processes for public API changes. Your pull request would also need to include unit and/or integration tests (if appropriate). So it is likely a non-trivial time commitment for you with all of the back and forth that will likely be involved. Something that would be of particular interest to us is your thoughts on what the public API change would look like. It would need to be backwards compatible (so existing applications continue to work). I have a preliminary idea, but would like to hear your thoughts. |
@mdietrichstein You can throw exception within The above is not the most elegant solution, but it works. |
Thanks @tom-andersen I will try that. @dconeybe Great, I'll check it out once we've wrapped up our current release and think about how to implement this feature and its effect on the public API 👍 |
Hello,
This issue is similar to #574.
I want to use
query.stream
and perform some client-side filtering. In our case, this is necessary to work around two Firestore limitations:array-contains
per disjunction is allowed.So, we perform one inequality check and one
array-contains
in the Firestore query and check for the remaining constraints client-side. The thing is, we only need the first X matching results. After the first X results, we want to stop the stream. Here's some code:I found that
ResponseQueryObserver.onStart
inQuery.internalStream
gets passed aStreamController
instance which has acancel
method. Could this be exposed to the user?I think this is a common use case and would be a nice feature to have, especially when working with large collections where only a handful of results are needed per query.
The text was updated successfully, but these errors were encountered: