couchdb-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From fdman...@apache.org
Subject git commit: Open replicator database in child process
Date Wed, 05 Oct 2011 00:15:15 GMT
Updated Branches:
  refs/heads/1.2.x a645b0f4b -> 6b7359ca8


Open replicator database in child process

This is more correct and less confusing.


Project: http://git-wip-us.apache.org/repos/asf/couchdb/repo
Commit: http://git-wip-us.apache.org/repos/asf/couchdb/commit/6b7359ca
Tree: http://git-wip-us.apache.org/repos/asf/couchdb/tree/6b7359ca
Diff: http://git-wip-us.apache.org/repos/asf/couchdb/diff/6b7359ca

Branch: refs/heads/1.2.x
Commit: 6b7359ca8c05bf691949a2ca4f8ceb0d7495d384
Parents: a645b0f
Author: Filipe David Manana <fdmanana@apache.org>
Authored: Wed Oct 5 01:10:54 2011 +0100
Committer: Filipe David Manana <fdmanana@apache.org>
Committed: Wed Oct 5 01:13:07 2011 +0100

----------------------------------------------------------------------
 src/couchdb/couch_replication_manager.erl |   11 +++++++----
 1 files changed, 7 insertions(+), 4 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/couchdb/blob/6b7359ca/src/couchdb/couch_replication_manager.erl
----------------------------------------------------------------------
diff --git a/src/couchdb/couch_replication_manager.erl b/src/couchdb/couch_replication_manager.erl
index 5885732..7d1860e 100644
--- a/src/couchdb/couch_replication_manager.erl
+++ b/src/couchdb/couch_replication_manager.erl
@@ -223,9 +223,12 @@ code_change(_OldVsn, State, _Extra) ->
 
 changes_feed_loop() ->
     {ok, RepDb} = ensure_rep_db_exists(),
+    RepDbName = couch_db:name(RepDb),
+    couch_db:close(RepDb),
     Server = self(),
     Pid = spawn_link(
         fun() ->
+            {ok, Db} = couch_db:open_int(RepDbName, [sys_db]),
             ChangesFeedFun = couch_changes:handle_changes(
                 #changes_args{
                     include_docs = true,
@@ -234,7 +237,7 @@ changes_feed_loop() ->
                     db_open_options = [sys_db]
                 },
                 {json_req, null},
-                RepDb
+                Db
             ),
             ChangesFeedFun(
                 fun({change, Change, _}, _) ->
@@ -248,11 +251,11 @@ changes_feed_loop() ->
                 (_, _) ->
                     ok
                 end
-            )
+            ),
+            couch_db:close(Db)
         end
     ),
-    couch_db:close(RepDb),
-    {Pid, couch_db:name(RepDb)}.
+    {Pid, RepDbName}.
 
 
 has_valid_rep_id({Change}) ->


Mime
View raw message