couchdb-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From kocol...@apache.org
Subject svn commit: r807477 - /couchdb/trunk/src/couchdb/couch_rep_changes_feed.erl
Date Tue, 25 Aug 2009 04:49:39 GMT
Author: kocolosk
Date: Tue Aug 25 04:49:39 2009
New Revision: 807477

URL: http://svn.apache.org/viewvc?rev=807477&view=rev
Log:
fix a process leak in local changes feed consumer

Modified:
    couchdb/trunk/src/couchdb/couch_rep_changes_feed.erl

Modified: couchdb/trunk/src/couchdb/couch_rep_changes_feed.erl
URL: http://svn.apache.org/viewvc/couchdb/trunk/src/couchdb/couch_rep_changes_feed.erl?rev=807477&r1=807476&r2=807477&view=diff
==============================================================================
--- couchdb/trunk/src/couchdb/couch_rep_changes_feed.erl (original)
+++ couchdb/trunk/src/couchdb/couch_rep_changes_feed.erl Tue Aug 25 04:49:39 2009
@@ -97,7 +97,12 @@
     false ->
         spawn_link(fun() -> send_local_changes_once(Server, Source, Since) end);
     true ->
-        spawn_link(fun() -> send_local_changes_forever(Server, Source, Since) end)
+        spawn_link(fun() ->
+            Self = self(),
+            {ok, _} = couch_db_update_notifier:start_link(fun(Msg) ->
+                local_update_notification(Self, Source#db.name, Msg) end),
+            send_local_changes_forever(Server, Source, Since)
+        end)
     end,
     {ok, #state{changes_loop=ChangesPid}}.
 
@@ -312,9 +317,6 @@
 
 send_local_changes_forever(Server, Db, Since) ->
     #db{name = DbName, user_ctx = UserCtx} = Db,
-    Self = self(),
-    {ok, _} = couch_db_update_notifier:start_link(
-        fun(Msg) -> local_update_notification(Self, DbName, Msg) end),
     {ok, NewSeq} = send_local_changes_once(Server, Db, Since),
     couch_db:close(Db),
     ok = wait_db_updated(),



Mime
View raw message