74 lines
2.2 KiB
Erlang
74 lines
2.2 KiB
Erlang
%%%-------------------------------------------------------------------
|
|
%%% @author anlicheng
|
|
%%% @copyright (C) 2025, <COMPANY>
|
|
%%% @doc
|
|
%%%
|
|
%%% @end
|
|
%%% Created : 18. 4月 2025 16:42
|
|
%%%-------------------------------------------------------------------
|
|
-module(efka_model_sup).
|
|
-author("anlicheng").
|
|
-include("efka_tables.hrl").
|
|
|
|
-behaviour(supervisor).
|
|
|
|
%% API
|
|
-export([start_link/0]).
|
|
|
|
%% Supervisor callbacks
|
|
-export([init/1]).
|
|
|
|
-define(SERVER, ?MODULE).
|
|
|
|
%%%===================================================================
|
|
%%% API functions
|
|
%%%===================================================================
|
|
|
|
%% @doc Starts the supervisor
|
|
-spec(start_link() -> {ok, Pid :: pid()} | ignore | {error, Reason :: term()}).
|
|
start_link() ->
|
|
supervisor:start_link({local, ?SERVER}, ?MODULE, []).
|
|
|
|
%%%===================================================================
|
|
%%% Supervisor callbacks
|
|
%%%===================================================================
|
|
|
|
%% @private
|
|
%% @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.
|
|
init([]) ->
|
|
SupFlags = #{strategy => one_for_one, intensity => 1000, period => 3600},
|
|
Specs = [
|
|
#{
|
|
id => cache_model,
|
|
start => {cache_model, start_link, []},
|
|
restart => permanent,
|
|
shutdown => 5000,
|
|
type => worker,
|
|
modules => ['cache_model']
|
|
},
|
|
#{
|
|
id => service_model,
|
|
start => {service_model, start_link, []},
|
|
restart => permanent,
|
|
shutdown => 5000,
|
|
type => worker,
|
|
modules => ['service_model']
|
|
},
|
|
#{
|
|
id => task_log_model,
|
|
start => {task_log_model, start_link, []},
|
|
restart => permanent,
|
|
shutdown => 5000,
|
|
type => worker,
|
|
modules => ['task_log_model']
|
|
}
|
|
],
|
|
|
|
{ok, {SupFlags, Specs}}.
|
|
|
|
%%%===================================================================
|
|
%%% Internal functions
|
|
%%%=================================================================== |