fix
This commit is contained in:
parent
9b2f75f9d1
commit
d01a44b234
@ -76,8 +76,14 @@ init([]) ->
|
||||
case emqtt:start_link(Opts) of
|
||||
{ok, ConnPid} ->
|
||||
lager:debug("[iot_mqtt_subscriber] connect success, pid: ~p", [ConnPid]),
|
||||
%% 快速启动避免阻塞iot_host_sup的启动
|
||||
erlang:start_timer(0, self(), subscribe_ticker),
|
||||
%% 监听和host相关的全部事件
|
||||
{ok, _} = emqtt:connect(ConnPid),
|
||||
Topics = [
|
||||
{<<"$share/nodes_group//server/register">>, 1},
|
||||
{<<"$share/nodes_group//host/+/upstream">>, 1}
|
||||
],
|
||||
SubscribeResult = emqtt:subscribe(ConnPid, Topics),
|
||||
lager:debug("[iot_mqtt_subscriber] subscribe result is: ~p", [SubscribeResult]),
|
||||
|
||||
{ok, #state{conn_pid = ConnPid}};
|
||||
ignore ->
|
||||
|
||||
@ -28,14 +28,14 @@ start_link() ->
|
||||
init([]) ->
|
||||
SupFlags = #{strategy => one_for_one, intensity => 1000, period => 3600},
|
||||
ChildSpecs = [
|
||||
#{
|
||||
id => 'iot_host_sup',
|
||||
start => {'iot_host_sup', start_link, []},
|
||||
restart => permanent,
|
||||
shutdown => 2000,
|
||||
type => supervisor,
|
||||
modules => ['iot_host_sup']
|
||||
},
|
||||
%#{
|
||||
% id => 'iot_host_sup',
|
||||
% start => {'iot_host_sup', start_link, []},
|
||||
% restart => permanent,
|
||||
% shutdown => 2000,
|
||||
% type => supervisor,
|
||||
% modules => ['iot_host_sup']
|
||||
%},
|
||||
|
||||
#{
|
||||
id => 'iot_router_sup',
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user