This commit is contained in:
anlicheng 2025-09-16 19:07:57 +08:00
parent 7e4611d16b
commit 63d6a8f264
2 changed files with 1 additions and 19 deletions

View File

@ -20,7 +20,7 @@
%% API
-export([start_link/2]).
-export([get_name/1, get_pid/1, attach_channel/3]).
-export([push_envs/3, invoke/3]).
-export([invoke/3]).
-export([metric_data/4, send_event/3]).
%% gen_server callbacks
@ -53,10 +53,6 @@ get_name(ContainerId) when is_binary(ContainerId) ->
get_pid(ContainerId) when is_binary(ContainerId) ->
whereis(get_name(ContainerId)).
-spec push_envs(Pid :: pid(), Ref :: reference(), Envs :: binary()) -> no_return().
push_envs(Pid, Ref, Envs) when is_pid(Pid), is_binary(Envs) ->
gen_server:cast(Pid, {push_envs, Ref, self(), Envs}).
-spec invoke(Pid :: pid(), Ref :: reference(), Payload :: binary()) -> no_return().
invoke(Pid, Ref, Payload) when is_pid(Pid), is_reference(Ref), is_binary(Payload) ->
gen_server:cast(Pid, {invoke, Ref, self(), Payload}).
@ -142,19 +138,6 @@ handle_cast({send_event, EventType, Params}, State = #state{container_id = Conta
lager:debug("[efka_service] send_event, container_id: ~p, meta: ~p, event_type: ~p, params: ~p", [ContainerId, MetaTag, EventType, Params]),
{noreply, State};
%%
handle_cast({push_envs, Ref, ReceiverPid, Envs}, State = #state{channel_pid = ChannelPid, container_id = ContainerId, inflight = Inflight, callbacks = Callbacks}) ->
case is_pid(ChannelPid) andalso is_process_alive(ChannelPid) of
true ->
ws_channel:push_config(ChannelPid, Ref, self(), Envs),
%%
CB = fun() -> service_model:set_config(ContainerId, Envs) end,
{noreply, State#state{inflight = maps:put(Ref, ReceiverPid, Inflight), callbacks = maps:put(Ref, CB, Callbacks)}};
false ->
ReceiverPid ! {service_reply, Ref, {error, <<"channel is not alive">>}},
{noreply, State}
end;
%%
handle_cast({invoke, Ref, ReceiverPid, Payload}, State = #state{channel_pid = ChannelPid, inflight = Inflight}) ->
case is_pid(ChannelPid) andalso is_process_alive(ChannelPid) of

View File

@ -22,7 +22,6 @@
packet_id = 1,
container_pid :: undefined | pid(),
is_registered = false :: boolean(),
%% , #{packet_id => {ReceiverPid, Ref}}; inflight需要超时逻辑处理
inflight = #{}
}).