fix channel
This commit is contained in:
parent
3a8c621f7b
commit
ace9157b0f
@ -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}) ->
|
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
|
case is_pid(ChannelPid) andalso is_process_alive(ChannelPid) of
|
||||||
true ->
|
true ->
|
||||||
efka_tcp_channel:push_config(ChannelPid, Ref, self(), ConfigJson),
|
tcp_channel:push_config(ChannelPid, Ref, self(), ConfigJson),
|
||||||
%% 设置成功,需要更新微服务的配置
|
%% 设置成功,需要更新微服务的配置
|
||||||
CB = fun() -> service_model:set_config(ServiceId, ConfigJson) end,
|
CB = fun() -> service_model:set_config(ServiceId, ConfigJson) end,
|
||||||
{noreply, State#state{inflight = maps:put(Ref, ReceiverPid, Inflight), callbacks = maps:put(Ref, CB, Callbacks)}};
|
{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}) ->
|
handle_cast({invoke, Ref, ReceiverPid, Payload}, State = #state{channel_pid = ChannelPid, inflight = Inflight}) ->
|
||||||
case is_pid(ChannelPid) andalso is_process_alive(ChannelPid) of
|
case is_pid(ChannelPid) andalso is_process_alive(ChannelPid) of
|
||||||
true ->
|
true ->
|
||||||
efka_tcp_channel:invoke(ChannelPid, Ref, self(), Payload),
|
tcp_channel:invoke(ChannelPid, Ref, self(), Payload),
|
||||||
{noreply, State#state{inflight = maps:put(Ref, ReceiverPid, Inflight)}};
|
{noreply, State#state{inflight = maps:put(Ref, ReceiverPid, Inflight)}};
|
||||||
false ->
|
false ->
|
||||||
ReceiverPid ! {service_reply, Ref, {error, <<"channel is not alive">>}},
|
ReceiverPid ! {service_reply, Ref, {error, <<"channel is not alive">>}},
|
||||||
|
|||||||
@ -13,7 +13,7 @@
|
|||||||
-export([start_server/0]).
|
-export([start_server/0]).
|
||||||
|
|
||||||
start_server() ->
|
start_server() ->
|
||||||
{ok, Props} = application:get_env(iot, ws_server),
|
{ok, Props} = application:get_env(efka, ws_server),
|
||||||
Acceptors = proplists:get_value(acceptors, Props, 50),
|
Acceptors = proplists:get_value(acceptors, Props, 50),
|
||||||
MaxConnections = proplists:get_value(max_connections, Props, 10240),
|
MaxConnections = proplists:get_value(max_connections, Props, 10240),
|
||||||
Backlog = proplists:get_value(backlog, Props, 1024),
|
Backlog = proplists:get_value(backlog, Props, 1024),
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user