couchdb-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From kocol...@apache.org
Subject [17/50] git commit: Open replicator database in child process
Date Wed, 26 Oct 2011 18:05:33 GMT
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/0c7fbd3d
Tree: http://git-wip-us.apache.org/repos/asf/couchdb/tree/0c7fbd3d
Diff: http://git-wip-us.apache.org/repos/asf/couchdb/diff/0c7fbd3d

Branch: refs/heads/1319-large-headers-are-corrupted
Commit: 0c7fbd3dab5bf13215def4349dbba7f689a22ac6
Parents: 3c24a94
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:12:45 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/0c7fbd3d/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