This commit is contained in:
anlicheng 2025-11-11 20:42:54 +08:00
parent f942f8090e
commit 9e11097b25
3 changed files with 53 additions and 4 deletions

View File

@ -0,0 +1,49 @@
%%%-------------------------------------------------------------------
%% @doc endpoint top level supervisor.
%% @end
%%%-------------------------------------------------------------------
-module(endpoint_sup_sup).
-behaviour(supervisor).
-include("endpoint.hrl").
-export([start_link/0]).
-export([init/1]).
-define(SERVER, ?MODULE).
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 => one_for_all, intensity => 1000, period => 3600},
ChildSpecs = [
#{
id => endpoint_subscription,
start => {'endpoint_subscription', start_link, []},
restart => permanent,
shutdown => 2000,
type => worker,
modules => ['endpoint_subscription']
},
#{
id => 'endpoint_sup',
start => {'endpoint_sup', start_link, []},
restart => permanent,
shutdown => 2000,
type => supervisor,
modules => ['endpoint_sup']
}
],
{ok, {SupFlags, ChildSpecs}}.

View File

@ -47,12 +47,12 @@ init([]) ->
},
#{
id => 'endpoint_sup',
start => {'endpoint_sup', start_link, []},
id => endpoint_sup_sup,
start => {'endpoint_sup_sup', start_link, []},
restart => permanent,
shutdown => 2000,
type => supervisor,
modules => ['endpoint_sup']
modules => ['endpoint_sup_sup']
},
#{

View File

@ -25,7 +25,7 @@
{port, 18080}
]},
{api_url, "http://39.98.184.67:8800/api/v1/taskLog"},
{api_url, "http://100.123.0.4/api/v1/"},
%% 目标服务器地址
{emqx_server, [