fix
This commit is contained in:
parent
05111807ca
commit
cec6e42a0d
@ -185,10 +185,9 @@ handle_call(start_service, _From, State = #state{running_status = ?STATUS_STOPPE
|
|||||||
%% 异步启动服务
|
%% 异步启动服务
|
||||||
case efka_manifest:startup(Manifest) of
|
case efka_manifest:startup(Manifest) of
|
||||||
{ok, Port} ->
|
{ok, Port} ->
|
||||||
%% 更新数据库状态
|
|
||||||
micro_service_model:start_service(ServiceId),
|
|
||||||
{os_pid, OSPid} = erlang:port_info(Port, os_pid),
|
{os_pid, OSPid} = erlang:port_info(Port, os_pid),
|
||||||
lager:debug("start_service port: ~p, os_pid: ~p", [Port, OSPid]),
|
lager:debug("start_service port: ~p, os_pid: ~p", [Port, OSPid]),
|
||||||
|
%% 更新数据库状态
|
||||||
ok = micro_service_model:change_status(ServiceId, 1),
|
ok = micro_service_model:change_status(ServiceId, 1),
|
||||||
{reply, ok, State#state{running_status = ?STATUS_RUNNING, port = Port, os_pid = OSPid}};
|
{reply, ok, State#state{running_status = ?STATUS_RUNNING, port = Port, os_pid = OSPid}};
|
||||||
{error, Reason} ->
|
{error, Reason} ->
|
||||||
@ -205,10 +204,8 @@ handle_call(stop_service, _From, State = #state{running_status = ?STATUS_RUNNING
|
|||||||
%% 优先使用微服务提供的stop指令, 没有提供的情况下,使用kill指令
|
%% 优先使用微服务提供的stop指令, 没有提供的情况下,使用kill指令
|
||||||
kill_os_pid(OSPid),
|
kill_os_pid(OSPid),
|
||||||
|
|
||||||
micro_service_model:stop_service(ServiceId),
|
|
||||||
erlang:is_port(Port) andalso erlang:port_close(Port),
|
erlang:is_port(Port) andalso erlang:port_close(Port),
|
||||||
lager:debug("port: ~p, os_pid: ~p, will closed", [Port, OSPid]),
|
lager:debug("port: ~p, os_pid: ~p, will closed", [Port, OSPid]),
|
||||||
|
|
||||||
ok = micro_service_model:change_status(ServiceId, 0),
|
ok = micro_service_model:change_status(ServiceId, 0),
|
||||||
|
|
||||||
{reply, ok, State#state{port = undefined, os_pid = undefined, running_status = ?STATUS_STOPPED}};
|
{reply, ok, State#state{port = undefined, os_pid = undefined, running_status = ?STATUS_STOPPED}};
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user