I was trying to figure it out how cursor.observe runs inside meteor, but found nothing about it. Docs says
Establishes a live query that notifies callbacks on any change to the query result.
I would like to understand better what live query means.
When we have more than just a user subscribing an observer, one instance runs for each client, leading us to a performance and race condition issue.
observe
to it be like a singleton
? Just one instance running for all.Edit: There was a third question here, but now it is a separated question: How to avoid race conditions on cursor.observe?
Server side, as of right now, observe
works as follows:
There are plans (possibly in the next release) to automatically ensure that calls to subscribe that have the same arguments are shared. So basically taking care of the singleton part for you automatically.
Certainly you could achieve something like this yourself, but I believe it's a high priority for the meteor team, so it's probably not worth the effort at this point.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With