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

Use with changefeeds? #3

Closed
GeoffreyPlitt opened this issue Aug 11, 2016 · 6 comments
Closed

Use with changefeeds? #3

GeoffreyPlitt opened this issue Aug 11, 2016 · 6 comments

Comments

@GeoffreyPlitt
Copy link

Does this work with changefeeds?

@tjmehta
Copy link
Owner

tjmehta commented Aug 11, 2016

Yup, works with all rethinkdb cursors

@GeoffreyPlitt
Copy link
Author

Well, changefeeds have no end/close, so would the onCompleted() ever get called?

I'd like to use the toArray() behavior of non-changefeed-cursors, but with changefeeds, instead of using each() logic.

@tjmehta
Copy link
Owner

tjmehta commented Aug 11, 2016

Exactly! 'onCompleted' will never be called with changefeed cursors. You will have to dispose the subscription to close the cursor. Also keep in mind, this inherits from the base Observable (not ConnectableObservable). I am not sure if your familiar with connectable observables and rxjs. To subscribe to the observable multiple times you'll probably use 'publish().refCount()'.

@GeoffreyPlitt
Copy link
Author

Gotcha, thanks.

@tjmehta
Copy link
Owner

tjmehta commented Aug 11, 2016

I don't fully understand what you're wanting out of toArray(), but assuming you know some scenario where you want to stop listening to the changefeed.. I'm sure there is an rxjs observable operator that trigger 'completed' after it receives a certain number of results or passes some test.

@tjmehta
Copy link
Owner

tjmehta commented Aug 11, 2016

Or obviously, just unsubscribe after you get the last result you want.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants