You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@couchdb.apache.org by rn...@apache.org on 2014/08/27 18:54:37 UTC
git commit: This dog won't hunt, no sir
Repository: couchdb-couch-event
Updated Branches:
refs/heads/windsor-merge b52b9c5ab -> 06477c261
This dog won't hunt, no sir
Project: http://git-wip-us.apache.org/repos/asf/couchdb-couch-event/repo
Commit: http://git-wip-us.apache.org/repos/asf/couchdb-couch-event/commit/06477c26
Tree: http://git-wip-us.apache.org/repos/asf/couchdb-couch-event/tree/06477c26
Diff: http://git-wip-us.apache.org/repos/asf/couchdb-couch-event/diff/06477c26
Branch: refs/heads/windsor-merge
Commit: 06477c261205813e732d8f418c70942c33e01a8b
Parents: b52b9c5
Author: Robert Newson <rn...@apache.org>
Authored: Wed Aug 27 16:52:17 2014 +0100
Committer: Robert Newson <rn...@apache.org>
Committed: Wed Aug 27 16:52:20 2014 +0100
----------------------------------------------------------------------
src/couch_event_server.erl | 32 ++------------------------------
1 file changed, 2 insertions(+), 30 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/couchdb-couch-event/blob/06477c26/src/couch_event_server.erl
----------------------------------------------------------------------
diff --git a/src/couch_event_server.erl b/src/couch_event_server.erl
index 18509ec..321e8fa 100644
--- a/src/couch_event_server.erl
+++ b/src/couch_event_server.erl
@@ -28,18 +28,13 @@
code_change/3
]).
--export([
- watchdog/0
-]).
-
-include("couch_event_int.hrl").
-record(st, {
by_pid,
- by_dbname,
- watchdog
+ by_dbname
}).
@@ -52,8 +47,7 @@ init(_) ->
{ok, ByDbName} = khash:new(),
{ok, #st{
by_pid = ByPid,
- by_dbname = ByDbName,
- watchdog = spawn_monitor(?MODULE, watchdog, [])
+ by_dbname = ByDbName
}}.
@@ -97,10 +91,6 @@ handle_cast(Msg, St) ->
{noreply, St}.
-handle_info({'DOWN', Ref, _, _, Reason}, #st{watchdog={_,Ref}}=St) ->
- couch_log:notice("~s watchdog died: ~w", [?MODULE, Reason]),
- erlang:send_after(60000, self(), spawn_watchdog),
- {noreply, St#st{watchdog=undefined}};
handle_info({'DOWN', Ref, process, Pid, _Reason}, St) ->
case khash:get(St#st.by_pid, Pid) of
{Ref, OldDbNames} ->
@@ -111,9 +101,6 @@ handle_info({'DOWN', Ref, process, Pid, _Reason}, St) ->
{noreply, St};
-handle_info(spawn_watchdog, #st{watchdog=undefined}=St) ->
- NewWD = spawn_monitor(?MODULE, watchdog, []),
- {noreply, St#st{watchdog=NewWD}};
handle_info(Msg, St) ->
couch_log:notice("~s ignoring info ~w", [?MODULE, Msg]),
{noreply, St}.
@@ -123,21 +110,6 @@ code_change(_OldVsn, St, _Extra) ->
{ok, St}.
-watchdog() ->
- timer:sleep(300000),
- Handlers = gen_event:which_handlers(couch_db_update),
- case length(Handlers) > 0 of
- true ->
- supervisor:terminate_child(
- couch_primary_services, couch_db_update_event),
- supervisor:restart_child(
- couch_primary_services, couch_db_update_event);
- false ->
- ok
- end,
- ?MODULE:watchdog().
-
-
notify_listeners(ByDbName, DbName, Event) ->
Msg = {'$couch_event', DbName, Event},
notify_listeners(khash:get(ByDbName, all_dbs), Msg),