jo / couch-daemon

High-level os daemon API for CouchDB.
14 stars 2 forks source link

Each db update triggers two changes events #12

Closed ejeklint closed 10 years ago

ejeklint commented 10 years ago

Each update of a doc in a "followed" db creates two changes events which is a bummer. I guess this because the db first gets pushed to the dbs stream when daemon starts, and then again every time a 'changes' event is fired for that db.

I've tried to read code and figure out exactly what happens but it's difficult to follow the flow in all these streams and callbacks, so I need help figuring out the proper solution.

jo commented 10 years ago

Hi @ejeklint, I gonna look at this (as well as on the other issues) tomorrow. Thanks for reporting!

ejeklint commented 10 years ago

Thanks! A question about this also: when a db gets deleted, is the stream updated?

jo commented 10 years ago

since c3cdd46980a790c78c0c83efbc390a38106ef0e7 couch-daemon ignores the db update event. Before that commit, each change triggered an additional event:

{
  stream: 'dbs',
  type: 'update'
}

You can filter the events by looking at the stream property.