Files
gm_ctflow/src/gm_ctflow_worker_sup.erl
T
2026-05-30 13:16:14 +02:00

57 lines
1.5 KiB
Erlang

%%%-------------------------------------------------------------------
%% @doc gm_ctflow top level supervisor.
%% @end
%%%-------------------------------------------------------------------
-module(gm_ctflow_worker_sup).
-behaviour(supervisor).
-export([start_link/0]).
-export([child/2]).
-export([init/1]).
-export([reset/0]).
-define(SERVER, ?MODULE).
reset() ->
[ok = supervisor:terminate_child(?MODULE, Id)
|| {Id, _, _, _} <- supervisor:which_children(?MODULE)],
ok.
start_link() ->
supervisor:start_link({local, ?SERVER}, ?MODULE, []).
%% sup_flags() = #{strategy => strategy(), % optional
%% intensity => non_neg_integer(), % optional
%% period => pos_integer()} % optional
%% child_spec() = #{id => child_id(), % mandatory
%% start => mfargs(), % mandatory
%% restart => restart(), % optional
%% shutdown => shutdown(), % optional
%% type => worker(), % optional
%% modules => modules()} % optional
init([]) ->
SupFlags = #{
strategy => simple_one_for_one,
intensity => 0,
period => 1
},
ChildSpecs = [
child(gm_ctflow_worker, worker)
],
{ok, {SupFlags, ChildSpecs}}.
%% internal functions
child(Mod, Type) ->
#{ id => Mod
, start => {Mod, start_link, []}
, restart => permanent
, shutdown => 5000
, type => Type
, modules => [Mod]
}.