feathersjs-ecosystem / feathers-sync

Synchronize service events between Feathers application instances
MIT License
222 stars 41 forks source link

Fix broadcast wrong messages #9

Closed thomaschaaf closed 8 years ago

thomaschaaf commented 8 years ago

The on('message') is fired for every match. We should only broadcast it, if the path and event match.

With DEBUG=* node src/

Before:

feathers-sync:redis emitting event to channel todos patched +2ms
feathers-sync:redis got event "todos patched", calling old emit [object Object] +1ms
feathers-sync:redis got event "todos patched", calling old emit [object Object] +0ms
feathers-sync:redis got event "todos patched", calling old emit [object Object] +0ms
feathers-sync:redis got event "todos patched", calling old emit [object Object] +1ms

After:

feathers-sync:redis emitting event to channel todos patched +3ms
feathers-sync:redis got event "todos patched", calling old emit [object Object] +0ms
daffl commented 8 years ago

Makes sense, thank you. I'll publish a patch later today.