From d0c38854e49b8dced4276f914dddd87c8d7c2683 Mon Sep 17 00:00:00 2001 From: anlicheng <244108715@qq.com> Date: Wed, 12 Nov 2025 15:28:10 +0800 Subject: [PATCH] fix endpoint --- apps/iot/src/endpoint/endpoint_sup.erl | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/apps/iot/src/endpoint/endpoint_sup.erl b/apps/iot/src/endpoint/endpoint_sup.erl index 59bcec0..ad59018 100644 --- a/apps/iot/src/endpoint/endpoint_sup.erl +++ b/apps/iot/src/endpoint/endpoint_sup.erl @@ -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()}.