This commit is contained in:
anlicheng 2025-04-30 11:12:55 +08:00
parent 07c631d658
commit ed7aff2759
2 changed files with 7 additions and 7 deletions

View File

@ -14,7 +14,7 @@
%% API
-export([start_link/2]).
-export([get_name/1]).
-export([get_name/1, start_service/1, stop_service/1]).
%% gen_server callbacks
-export([init/1, handle_call/3, handle_cast/2, handle_info/2, terminate/2, code_change/3]).
@ -35,11 +35,11 @@
get_name(ServerId) when is_binary(ServerId) ->
list_to_atom("efka_server:" ++ binary_to_list(ServerId)).
start_server(Pid) when is_pid(Pid) ->
gen_server:call(Pid, start_server).
start_service(Pid) when is_pid(Pid) ->
gen_server:call(Pid, start_service).
stop_server(Pid) when is_pid(Pid) ->
gen_server:call(Pid, stop_server).
stop_service(Pid) when is_pid(Pid) ->
gen_server:call(Pid, stop_service).
%% @doc Spawns the server and registers the local name (unique)
-spec(start_link(Name :: atom(), ServerId :: binary()) ->

View File

@ -57,11 +57,11 @@ init([]) ->
#{
id => 'efka_server_sup',
start => {'efka_server_sup', start_link, []},
start => {'efka_micro_service_sup', start_link, []},
restart => permanent,
shutdown => 2000,
type => supervisor,
modules => ['efka_server_sup']
modules => ['efka_micro_service_sup']
}
],
{ok, {SupFlags, ChildSpecs}}.