couchdb-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From svilen ...@svilendobrev.com>
Subject Re: any good way of filtering out your own _changes?
Date Thu, 04 Oct 2012 17:34:39 GMT
ahha. i'll have a look.

i made quickly something like this - 100 lines wrapper of
python-couchdb Database class. It seems to work filtering out changes,
but as not all operations end in the changes-feed (say from 4 updates
and a delete of same doc, only the delete comes in the feed), the cache
that remembers all ops may grow. 
or maybe i'm missing something around the list of revs field in the
feed..

btw are rev-ids alone uniq enough (per database), or is (id,rev) the
uniq thing?

svil

 On Thu, 4 Oct 2012 09:59:40 -0700
Jens Alfke <jens@couchbase.com> wrote:

> 
> 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
View raw message