fix channel

This commit is contained in:
anlicheng 2025-09-10 15:12:31 +08:00
parent b1137bc1ad
commit 1fe2151030

View File

@ -169,7 +169,7 @@ handle_cast({send_event, EventType, Params}, State = #state{service_id = Service
handle_cast({push_config, Ref, ReceiverPid, ConfigJson}, State = #state{channel_pid = ChannelPid, service_id = ServiceId, inflight = Inflight, callbacks = Callbacks}) ->
case is_pid(ChannelPid) andalso is_process_alive(ChannelPid) of
true ->
tcp_channel:push_config(ChannelPid, Ref, self(), ConfigJson),
gen_channel:push_config(ChannelPid, Ref, self(), ConfigJson),
%%
CB = fun() -> service_model:set_config(ServiceId, ConfigJson) end,
{noreply, State#state{inflight = maps:put(Ref, ReceiverPid, Inflight), callbacks = maps:put(Ref, CB, Callbacks)}};
@ -182,7 +182,7 @@ handle_cast({push_config, Ref, ReceiverPid, ConfigJson}, State = #state{channel_
handle_cast({invoke, Ref, ReceiverPid, Payload}, State = #state{channel_pid = ChannelPid, inflight = Inflight}) ->
case is_pid(ChannelPid) andalso is_process_alive(ChannelPid) of
true ->
tcp_channel:invoke(ChannelPid, Ref, self(), Payload),
gen_channel:invoke(ChannelPid, Ref, self(), Payload),
{noreply, State#state{inflight = maps:put(Ref, ReceiverPid, Inflight)}};
false ->
ReceiverPid ! {service_reply, Ref, {error, <<"channel is not alive">>}},