You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@couchdb.apache.org by Benoit Chesneau <bc...@gmail.com> on 2010/08/18 11:02:24 UTC

using replication internally in custom handlers

Hi all,

I'm writing a custom handler here and for specific reason I want a
continuous replication of one design doc from a db to another db on
the same CouchDB server :

start_replication(Name) ->
    SourceDb = ?l2b(couch_config:get("myproject", "db", "somedb")),
    {ok, RepDb} = couch_rep:ensure_rep_db_exists(),
    RepDoc = {[
            {<<"_id">>, couch_uuids:new()},
            {<<"source">>, SourceDb},
            {<<"target">>, Name},
            {<<"doc_ids">>, [<<"_design/somedesign">>]},
            {<<"continuous">>, true}
    ]},

    couch_db:update_doc(RepDb, couch_doc:from_json_obj(RepDoc), []),
    ok.

(http://www.friendpaste.com/7YB7OfpudslHY8zUqEOVLb)

It works only for the first replication. When I check the active tasks
I can see the started replication, but updating the design doc on the
source db doesn't trigger replication. Any idea what could be the
problem here ?

- benoit