couchdb-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From iil...@apache.org
Subject [1/2] chttpd commit: updated refs/heads/master to 9a59ca1
Date Mon, 11 Jul 2016 14:55:24 GMT
Repository: couchdb-chttpd
Updated Branches:
  refs/heads/master 0627357bf -> 9a59ca11a


Inject _design/_auth on auth_cache startup

We send start_listener event from init to make sure we call
ensure_auth_ddoc_exists as soon as we can. Rather then calling it on
listener restart.

COUCHDB-3000


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

Branch: refs/heads/master
Commit: 3953f800aa420a76fe7a654cc27e653afd6d254d
Parents: 0627357
Author: ILYA Khlopotov <iilyak@ca.ibm.com>
Authored: Wed Apr 20 08:45:42 2016 -0700
Committer: ILYA Khlopotov <iilyak@ca.ibm.com>
Committed: Mon Jul 11 07:48:51 2016 -0700

----------------------------------------------------------------------
 src/chttpd_auth_cache.erl | 9 ++++++---
 1 file changed, 6 insertions(+), 3 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/couchdb-chttpd/blob/3953f800/src/chttpd_auth_cache.erl
----------------------------------------------------------------------
diff --git a/src/chttpd_auth_cache.erl b/src/chttpd_auth_cache.erl
index 6e14263..b676bf7 100644
--- a/src/chttpd_auth_cache.erl
+++ b/src/chttpd_auth_cache.erl
@@ -92,7 +92,8 @@ get_from_cache(UserName) ->
 %% gen_server callbacks
 
 init([]) ->
-    {ok, #state{changes_pid = spawn_changes(0)}}.
+    self() ! {start_listener, 0},
+    {ok, #state{}}.
 
 handle_call(_Call, _From, State) ->
     {noreply, State}.
@@ -116,8 +117,10 @@ handle_info({start_listener, Seq}, State) ->
 handle_info(_Msg, State) ->
     {noreply, State}.
 
-terminate(_Reason, #state{changes_pid = Pid}) ->
-    exit(Pid, kill).
+terminate(_Reason, #state{changes_pid = Pid}) when is_pid(Pid) ->
+    exit(Pid, kill);
+terminate(_Reason, _State) ->
+    ok.
 
 code_change(_OldVsn, #state{}=State, _Extra) ->
     {ok, State}.


Mime
View raw message