Permalink
Browse files

WHISTLE-1441: update sup child specs

  • Loading branch information...
1 parent 6a7589f commit 0922af92e380d4589a9ad37a828432a9ef7d767f James Aimonetti committed Dec 6, 2012
Showing with 9 additions and 12 deletions.
  1. +9 −12 whistle_apps/apps/acdc/src/acdc_sup.erl
@@ -19,34 +19,31 @@
-export([init/1]).
%% Helper macro for declaring children of supervisor
--define(CHILD(I, Type), {I, {I, start_link, []}, permanent, 5000, Type, [I]}).
-
--define(CHILDREN, [{acdc_agents_sup, supervisor}
- ,{acdc_queues_sup, supervisor}
- ,{acdc_stats, worker}
-%% ,{acdc_queue_manager, worker}
- ,{acdc_agent_manager, worker}
- ,{acdc_init, worker}
- ,{acdc_listener, worker}
+-define(CHILD(I, Type, Timeout), {I, {I, start_link, []}, permanent, Timeout, Type, [I]}).
+
+-define(CHILDREN, [{acdc_agents_sup, supervisor, infinity}
+ ,{acdc_queues_sup, supervisor, infinity}
+ ,{acdc_stats, worker, 5000}
+ ,{acdc_agent_manager, worker, 5000}
+ ,{acdc_init, worker, 5000}
+ ,{acdc_listener, worker, 5000}
]).
%% ===================================================================
%% API functions
%% ===================================================================
-
start_link() ->
supervisor:start_link({local, ?MODULE}, ?MODULE, []).
%% ===================================================================
%% Supervisor callbacks
%% ===================================================================
-
-spec init([]) -> sup_init_ret().
init([]) ->
RestartStrategy = one_for_one,
MaxRestarts = 5,
MaxSecondsBetweenRestarts = 10,
SupFlags = {RestartStrategy, MaxRestarts, MaxSecondsBetweenRestarts},
- Children = [?CHILD(Name, Type) || {Name, Type} <- ?CHILDREN],
+ Children = [?CHILD(Name, Type, Timeout) || {Name, Type, Timeout} <- ?CHILDREN],
{ok, {SupFlags, Children}}.

0 comments on commit 0922af9

Please sign in to comment.