summaryrefslogtreecommitdiff
path: root/apps/couch/src/couch_secondary_sup.erl
blob: 8ccbd799a5a454a2256594e467d56668f70cfbb4 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
-module(couch_secondary_sup).
-behaviour(supervisor).
-export([init/1, start_link/0]).

start_link() ->
    supervisor:start_link({local,couch_secondary_services}, ?MODULE, []).
init([]) ->
    SecondarySupervisors = [
        {couch_db_update_notifier_sup,
            {couch_db_update_notifier_sup, start_link, []},
            permanent,
            infinity,
            supervisor,
            [couch_db_update_notifier_sup]},
        {couch_metrics_event_manager,
            {gen_event, start_link, [{local, couch_metrics_event_manager}]},
            permanent,
            brutal_kill,
            worker,
            dynamic}
    ],
    Children = SecondarySupervisors ++ [
        begin
            {ok, {Module, Fun, Args}} = couch_util:parse_term(SpecStr),

            {list_to_atom(Name),
                {Module, Fun, Args},
                permanent,
                brutal_kill,
                worker,
                [Module]}
        end
        || {Name, SpecStr}
        <- couch_config:get("daemons"), SpecStr /= ""],
    {ok, {{one_for_one, 10, 3600}, Children}}.