diff --git a/apps/efka/src/efka_micro_service.erl b/apps/efka/src/efka_micro_service.erl index d29968d..b320b78 100644 --- a/apps/efka/src/efka_micro_service.erl +++ b/apps/efka/src/efka_micro_service.erl @@ -185,10 +185,9 @@ handle_call(start_service, _From, State = #state{running_status = ?STATUS_STOPPE %% 异步启动服务 case efka_manifest:startup(Manifest) of {ok, Port} -> - %% 更新数据库状态 - micro_service_model:start_service(ServiceId), {os_pid, OSPid} = erlang:port_info(Port, os_pid), lager:debug("start_service port: ~p, os_pid: ~p", [Port, OSPid]), + %% 更新数据库状态 ok = micro_service_model:change_status(ServiceId, 1), {reply, ok, State#state{running_status = ?STATUS_RUNNING, port = Port, os_pid = OSPid}}; {error, Reason} -> @@ -205,10 +204,8 @@ handle_call(stop_service, _From, State = #state{running_status = ?STATUS_RUNNING %% 优先使用微服务提供的stop指令, 没有提供的情况下,使用kill指令 kill_os_pid(OSPid), - micro_service_model:stop_service(ServiceId), erlang:is_port(Port) andalso erlang:port_close(Port), lager:debug("port: ~p, os_pid: ~p, will closed", [Port, OSPid]), - ok = micro_service_model:change_status(ServiceId, 0), {reply, ok, State#state{port = undefined, os_pid = undefined, running_status = ?STATUS_STOPPED}};