Cursor.observe with multiple meteor instances [Solved]

So, I’m using cursor.observe/observeChanges on the server to keep changes made to the database in sync with an elasticsearch instance. Currently, I’m just running this on one Meteor instance. But I’m thinking that if I add a Meteor instance, each instance will respond to the database changes, bombarding my elasticsearch cluster with duplicate adds/updates/deletes etc.

Am I correct here? And if so, is there a canonical solution to this?

See the following from the Cluster project:

Here’s my approach to similar scenarios:

  1. Instead of observing, use “hooks” to sync data

  2. Create a single separate worker or a cron (percolate synced cron and vsivsi jobcollection are nice) to do occasional cleanups that make up for faulty hooks

@hwillson, @serkandurusoy - thanks guys. Great info.

1 Like