diff options
author | Adam Kocoloski <kocolosk@apache.org> | 2009-08-25 04:49:39 +0000 |
---|---|---|
committer | Adam Kocoloski <kocolosk@apache.org> | 2009-08-25 04:49:39 +0000 |
commit | 72be948397f73956fc4c2e39fc99f0ec81d92ed0 (patch) | |
tree | 24d15ccfe1f9fc2dcb89c30c31d5bc59d0666318 /src | |
parent | 358a7c7f77ea684b8dfe3e6b0d1019cff865539e (diff) |
fix a process leak in local changes feed consumer
git-svn-id: https://svn.apache.org/repos/asf/couchdb/trunk@807477 13f79535-47bb-0310-9956-ffa450edef68
Diffstat (limited to 'src')
-rw-r--r-- | src/couchdb/couch_rep_changes_feed.erl | 10 |
1 files changed, 6 insertions, 4 deletions
diff --git a/src/couchdb/couch_rep_changes_feed.erl b/src/couchdb/couch_rep_changes_feed.erl index 7ff741e4..da324a0e 100644 --- a/src/couchdb/couch_rep_changes_feed.erl +++ b/src/couchdb/couch_rep_changes_feed.erl @@ -97,7 +97,12 @@ init([_Parent, Source, Since, PostProps]) -> 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 @@ maybe_stream_next(_) -> 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(), |