diff --git a/apps/iot/src/http_handlers/endpoint_handler.erl b/apps/iot/src/http_handlers/endpoint_handler.erl index 9e19ade..5be9f1c 100644 --- a/apps/iot/src/http_handlers/endpoint_handler.erl +++ b/apps/iot/src/http_handlers/endpoint_handler.erl @@ -78,11 +78,11 @@ handle_request("POST", "/endpoint/restart", _, #{<<"id">> := Id}) when is_intege lager:warning("[endpoint_handler] start endpoint: ~p, get error: ~p", [Title, Reason]), {ok, 200, iot_util:json_error(404, <<"restart endpoint error">>)} end; - Pid -> + Pid when is_pid(Pid) -> case endpoint_sup:delete_endpoint(Id) of ok -> case endpoint_sup:ensured_endpoint_started(Endpoint) of - {ok, Pid} when is_pid(Pid) -> + {ok, Pid0} when is_pid(Pid0) -> {ok, 200, iot_util:json_data(<<"success">>)}; {error, Reason} -> lager:warning("[endpoint_handler] start endpoint: ~p, get error: ~p", [Title, Reason]),