diff options
author | Mark Hammond <mhammond@apache.org> | 2009-12-02 21:44:47 +0000 |
---|---|---|
committer | Mark Hammond <mhammond@apache.org> | 2009-12-02 21:44:47 +0000 |
commit | c32443a012dfe90d6872af829e8df9b743010c90 (patch) | |
tree | b910d78be1c6f6b2a139b2f69d1c682be2427c7c /src/couchdb/couch_external_manager.erl | |
parent | 8aca27f80f170598196d16e4e9841fda88ca93e5 (diff) |
COUCHDB-588: don't make log noise when an OS process chooses to terminate normally
git-svn-id: https://svn.apache.org/repos/asf/couchdb/trunk@886319 13f79535-47bb-0310-9956-ffa450edef68
Diffstat (limited to 'src/couchdb/couch_external_manager.erl')
-rw-r--r-- | src/couchdb/couch_external_manager.erl | 14 |
1 files changed, 11 insertions, 3 deletions
diff --git a/src/couchdb/couch_external_manager.erl b/src/couchdb/couch_external_manager.erl index 810b3d79..7e401389 100644 --- a/src/couchdb/couch_external_manager.erl +++ b/src/couchdb/couch_external_manager.erl @@ -37,6 +37,7 @@ config_change("external", UrlName) -> % gen_server API init([]) -> + process_flag(trap_exit, true), Handlers = ets:new(couch_external_manager_handlers, [set, private]), couch_config:register(fun config_change/2), {ok, Handlers}. @@ -81,12 +82,19 @@ handle_call({config, UrlName}, _From, Handlers) -> handle_cast(_Whatever, State) -> {noreply, State}. -handle_info({'EXIT', Reason, Pid}, Handlers) -> - ?LOG_DEBUG("EXTERNAL: Server ~p died. (reason: ~p)", [Pid, Reason]), +handle_info({'EXIT', Pid, normal}, Handlers) -> + ?LOG_INFO("EXTERNAL: Server ~p terminated normally", [Pid]), + % The process terminated normally without us asking - Remove Pid from the + % handlers table so we don't attempt to reuse it + ets:match_delete(Handlers, {'_', Pid}), + {noreply, Handlers}; + +handle_info({'EXIT', Pid, Reason}, Handlers) -> + ?LOG_INFO("EXTERNAL: Server ~p died. (reason: ~p)", [Pid, Reason]), % Remove Pid from the handlers table so we don't try closing % it a second time in terminate/2. ets:match_delete(Handlers, {'_', Pid}), - {stop, Handlers}. + {stop, normal, Handlers}. code_change(_OldVsn, State, _Extra) -> {ok, State}. |