couchdb-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From rnew...@apache.org
Subject [2/2] chttpd commit: updated refs/heads/master to 5e3bf1f
Date Tue, 12 Jul 2016 13:59:17 GMT
Tolerate failure of ensure_auth_ddoc_exists call

ensure_auth_ddoc_exists can crash if _users db does not exist, so move
it to the spawned listen_for_changes process where we already tolerate
the possibility of a crash (and have logic to restart after 5 seconds)

COUCHDB-3054


Project: http://git-wip-us.apache.org/repos/asf/couchdb-chttpd/repo
Commit: http://git-wip-us.apache.org/repos/asf/couchdb-chttpd/commit/5e3bf1f5
Tree: http://git-wip-us.apache.org/repos/asf/couchdb-chttpd/tree/5e3bf1f5
Diff: http://git-wip-us.apache.org/repos/asf/couchdb-chttpd/diff/5e3bf1f5

Branch: refs/heads/master
Commit: 5e3bf1f5e2e96841ce0d2b26606c7f590c067bdc
Parents: fc7287a
Author: Robert Newson <rnewson@apache.org>
Authored: Tue Jul 12 13:23:05 2016 +0100
Committer: Robert Newson <rnewson@apache.org>
Committed: Tue Jul 12 13:23:05 2016 +0100

----------------------------------------------------------------------
 src/chttpd_auth_cache.erl | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/couchdb-chttpd/blob/5e3bf1f5/src/chttpd_auth_cache.erl
----------------------------------------------------------------------
diff --git a/src/chttpd_auth_cache.erl b/src/chttpd_auth_cache.erl
index 75d77e8..c8a6ea9 100644
--- a/src/chttpd_auth_cache.erl
+++ b/src/chttpd_auth_cache.erl
@@ -112,7 +112,6 @@ handle_info({'DOWN', _, _, Pid, Reason}, #state{changes_pid=Pid} = State)
->
     erlang:send_after(5000, self(), {start_listener, Seq}),
     {noreply, State#state{last_seq=Seq}};
 handle_info({start_listener, Seq}, State) ->
-    ensure_auth_ddoc_exists(dbname(), <<"_design/_auth">>),
     {noreply, State#state{changes_pid = spawn_changes(Seq)}};
 handle_info(_Msg, State) ->
     {noreply, State}.
@@ -132,6 +131,7 @@ spawn_changes(Since) ->
     Pid.
 
 listen_for_changes(Since) ->
+    ensure_auth_ddoc_exists(dbname(), <<"_design/_auth">>),
     CBFun = fun ?MODULE:changes_callback/2,
     Args = #changes_args{
         feed = "continuous",


Mime
View raw message