First commit
This commit is contained in:
@@ -0,0 +1,37 @@
|
||||
%% -*- mode: erlang; erlang-indent-level: 4; indent-tabs-mode: nil -*-
|
||||
-module(gmhc_sup).
|
||||
|
||||
-behaviour(supervisor).
|
||||
|
||||
%% API
|
||||
-export([start_link/0]).
|
||||
|
||||
%% Supervisor callbacks
|
||||
-export([init/1]).
|
||||
|
||||
|
||||
start_link() ->
|
||||
supervisor:start_link({local, ?MODULE}, ?MODULE, []).
|
||||
|
||||
init([]) ->
|
||||
ChildSpecs = [ worker(gmhc_server)
|
||||
, worker(gmhc_handler)
|
||||
, supervisor(gmhc_connectors_sup) ],
|
||||
SupFlags = #{ strategy => one_for_one
|
||||
, intensity => 1
|
||||
, period => 5
|
||||
, auto_shutdown => never },
|
||||
{ok, {SupFlags, ChildSpecs}}.
|
||||
|
||||
|
||||
worker (Mod) -> child(Mod, worker).
|
||||
supervisor(Mod) -> child(Mod, supervisor).
|
||||
|
||||
child(Mod, Type) ->
|
||||
#{ id => Mod
|
||||
, type => Type
|
||||
, start => {Mod, start_link, []}
|
||||
, restart => permanent
|
||||
, shutdown => 5000
|
||||
, significant => false
|
||||
, modules => [Mod] }.
|
||||
Reference in New Issue
Block a user