fix channel
This commit is contained in:
parent
b1137bc1ad
commit
1fe2151030
@ -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">>}},
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user