gmhive_client/src/gmhc_sup.erl
2025-10-25 09:32:43 +02:00

40 lines
1.1 KiB
Erlang

%% -*- mode: erlang; erlang-indent-level: 4; indent-tabs-mode: nil -*-
-module(gmhc_sup).
-vsn("0.8.3").
-behaviour(supervisor).
%% API
-export([start_link/0]).
%% Supervisor callbacks
-export([init/1]).
start_link() ->
supervisor:start_link({local, ?MODULE}, ?MODULE, []).
init([]) ->
ChildSpecs = [ worker(gmhc_watchdog)
, worker(gmhc_server)
, worker(gmhc_handler)
, supervisor(gmhc_connectors_sup) ],
SupFlags = #{ strategy => rest_for_one
, intensity => 5 %% We really want the hive client to sort itself out
, period => 5*60 %% Timemout issues can happen infrequently
, 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] }.