couchdb-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Jens Alfke <j...@couchbase.com>
Subject Re: any good way of filtering out your own _changes?
Date Thu, 04 Oct 2012 16:59:40 GMT

On Oct 3, 2012, at 11:35 PM, svilen <az@svilendobrev.com<mailto:az@svilendobrev.com>>
wrote:

so i have a local db that replicates bidirectional with several
others. an app uses local db, listens to _changes and also puts
things sometimes. Any way to avoid it seeing it's own changes?

My CouchCocoa library (a CouchDB client library for Mac/iOS) does something like this —
it’s watching the _changes feed but tries not to notify the app about changes that it made
itself using CouchCocoa. It does this by tracking the revision IDs generated by changes that
it’s made, and filtering those out of the _changes feed. The tricky part is that there’s
a race condition between getting the PUT/POST response with the new rev ID, and getting the
notification in the _changes feed. In real life it seems that the _changes feed usually wins,
so I had to put in some buffering to avoid processing new _changes entries until there are
no more PUT/POST requests pending.

—Jens

Mime
  • Unnamed multipart/alternative (inline, None, 0 bytes)
View raw message