Meteor-Community-Packages / meteor-collection-hooks

Meteor Collection Hooks
https://atmospherejs.com/matb33/collection-hooks
MIT License
658 stars 90 forks source link

Does this work on multi-process environements? #220

Closed macrozone closed 7 years ago

macrozone commented 7 years ago

If my apps runs on multiple process, does e.g. an insert on one process trigger the hook on the other instance as well?

zimme commented 7 years ago

Nope, this only runs in the process which do the insert. If you need things to happen on all meteor instances whenever something is inserted/updated/removed I suggest doing a find on the dataset and observeChanges the cursor with added etc. and trigger the actions then.

zimme commented 7 years ago

There might be other solutions also.

zimme commented 7 years ago

Closing this as answered, please correct me if I'm wrong.

macrozone commented 5 years ago

Maybe some information for the archive ;-)

We used a lot of db observers on one of our projects (where this question here was relevant), but we noticed that it affects the memory consumption and performance of the db and the server if you have a lot of observers and the observed set is large.

We therefore using now more hooks then observers.

In general, there isn't a clear answer to what is the better solution, both solutions have down- and upsides.