%%%----------------------------------------------------------------------------- %%% @copyright (C) 2012-2019, 2600Hz %%% @doc %%% @author Karl Anderson %%% @author James Aimonetti %%% @author Peter Defebvre %%% @author Ben Wann %%% @end %%%----------------------------------------------------------------------------- -module(blackhole_sup). -behaviour(supervisor). -export([start_link/0]). -export([init/1]). -include("blackhole.hrl"). -define(SERVER, ?MODULE). -define(CHILDREN, [?WORKER('blackhole_listener') ,?WORKER('blackhole_tracking') ,?WORKER('blackhole_bindings') ,?WORKER('blackhole_init') ]). %%============================================================================== %% API functions %%============================================================================== %%------------------------------------------------------------------------------ %% @doc Starts the supervisor. %% @end %%------------------------------------------------------------------------------ -spec start_link() -> kz_types:startlink_ret(). start_link() -> supervisor:start_link({'local', ?SERVER}, ?MODULE, []). %%============================================================================== %% Supervisor callbacks %%============================================================================== %%------------------------------------------------------------------------------ %% @doc Whenever a supervisor is started using `supervisor:start_link/[2,3]', %% this function is called by the new process to find out about %% restart strategy, maximum restart frequency and child %% specifications. %% @end %%------------------------------------------------------------------------------ -spec init(any()) -> kz_types:sup_init_ret(). init([]) -> kz_util:set_startup(), RestartStrategy = 'one_for_one', MaxRestarts = 5, MaxSecondsBetweenRestarts = 10, SupFlags = {RestartStrategy, MaxRestarts, MaxSecondsBetweenRestarts}, {'ok', {SupFlags, ?CHILDREN}}.