From b6af63866f6f6677026080f8463ab82cd5a238ca Mon Sep 17 00:00:00 2001 From: anlicheng <244108715@qq.com> Date: Fri, 13 Dec 2024 11:57:02 +0800 Subject: [PATCH] fix device_sup --- apps/iot/src/iot_device_sup.erl | 3 +++ 1 file changed, 3 insertions(+) diff --git a/apps/iot/src/iot_device_sup.erl b/apps/iot/src/iot_device_sup.erl index 9b9d26d..bab1393 100644 --- a/apps/iot/src/iot_device_sup.erl +++ b/apps/iot/src/iot_device_sup.erl @@ -25,6 +25,9 @@ init([]) -> ensured_device_started(DeviceUUID) when is_binary(DeviceUUID) -> case iot_device:get_pid(DeviceUUID) of undefined -> + %% 先删除,然后添加 + Id = iot_device:get_name(DeviceUUID), + supervisor:delete_child(?MODULE, Id), case supervisor:start_child(?MODULE, child_spec(DeviceUUID)) of {ok, Pid} when is_pid(Pid) -> {ok, Pid};