couchdb-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From rnew...@apache.org
Subject [2/3] chttpd commit: updated refs/heads/master to ddd63ee
Date Thu, 01 Oct 2015 15:05:58 GMT
Pass supervisor's children to couch_epi


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

Branch: refs/heads/master
Commit: 96c46e93ee2e668727643b033999eb1538c09397
Parents: faca4ca
Author: ILYA Khlopotov <iilyak@ca.ibm.com>
Authored: Tue Sep 29 13:04:19 2015 -0700
Committer: ILYA Khlopotov <iilyak@ca.ibm.com>
Committed: Tue Sep 29 13:04:19 2015 -0700

----------------------------------------------------------------------
 src/chttpd_sup.erl | 16 ++++++----------
 1 file changed, 6 insertions(+), 10 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/couchdb-chttpd/blob/96c46e93/src/chttpd_sup.erl
----------------------------------------------------------------------
diff --git a/src/chttpd_sup.erl b/src/chttpd_sup.erl
index 64a5080..07dde48 100644
--- a/src/chttpd_sup.erl
+++ b/src/chttpd_sup.erl
@@ -18,21 +18,23 @@
 
 %% Helper macro for declaring children of supervisor
 -define(CHILD(I, Type), {I, {I, start_link, []}, permanent, 100, Type, [I]}).
--define(NAMED_CHILD(I, M, Type), {I, {M, start_link, []}, permanent, 100, Type, [M]}).
 
 start_link(Args) ->
     supervisor:start_link({local,?MODULE}, ?MODULE, Args).
 
 init([]) ->
     chttpd_config_listener:subscribe(),
-    ServiceProcesses = couch_epi:register_service(chttpd_epi),
 
-    {ok, {{one_for_one, 3, 10}, add_auth_cache_if_missing(ServiceProcesses) ++ [
+    Children = [
         ?CHILD(chttpd, worker),
+        ?CHILD(chttpd_auth_cache, worker),
         {chttpd_auth_cache_lru,
 	 {ets_lru, start_link, [chttpd_auth_cache_lru, lru_opts()]},
 	 permanent, 5000, worker, [ets_lru]}
-    ]}}.
+    ],
+
+    {ok, {{one_for_one, 3, 10},
+        couch_epi:register_service(chttpd_epi, Children)}}.
 
 lru_opts() ->
     case config:get("chttpd_auth_cache", "max_objects") of
@@ -53,9 +55,3 @@ lru_opts() ->
         _ ->
             []
     end.
-
-add_auth_cache_if_missing(Children) ->
-    case lists:keymember(auth_cache, 1, Children) of
-        true -> Children;
-        false -> [?NAMED_CHILD(auth_cache, chttpd_auth_cache, worker)]
-     end.


Mime
View raw message