fix endpoint
This commit is contained in:
parent
4405483b9d
commit
d0c38854e4
@ -30,19 +30,19 @@ start_link() ->
|
||||
init([]) ->
|
||||
SupFlags = #{strategy => one_for_one, intensity => 1000, period => 3600},
|
||||
Endpoints = iot_api:get_all_endpoints(),
|
||||
ChildSpecs = lists:flatmap(fun(EndpointInfo) ->
|
||||
ChildSpecs = lists:filtermap(fun(EndpointInfo) ->
|
||||
case endpoint:endpoint_record(EndpointInfo) of
|
||||
error ->
|
||||
[];
|
||||
false;
|
||||
{ok, Endpoint} ->
|
||||
case endpoint:is_support(endpoint:get_protocol(Endpoint)) of
|
||||
true ->
|
||||
[child_spec(Endpoint)];
|
||||
{true, child_spec(Endpoint)};
|
||||
false ->
|
||||
[]
|
||||
false
|
||||
end
|
||||
end
|
||||
end, Endpoints),
|
||||
end, Endpoints),
|
||||
{ok, {SupFlags, ChildSpecs}}.
|
||||
|
||||
-spec ensured_endpoint_started(Endpoint :: #endpoint{}) -> {ok, Pid :: pid()} | {error, Reason :: any()}.
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user