fix zd_mqtt_consumer
This commit is contained in:
parent
02bbd0832e
commit
7d26801d98
@ -190,16 +190,8 @@ handle_info(Info, State = #state{}) ->
|
|||||||
%% with Reason. The return value is ignored.
|
%% with Reason. The return value is ignored.
|
||||||
-spec(terminate(Reason :: (normal | shutdown | {shutdown, term()} | term()),
|
-spec(terminate(Reason :: (normal | shutdown | {shutdown, term()} | term()),
|
||||||
State :: #state{}) -> term()).
|
State :: #state{}) -> term()).
|
||||||
terminate(Reason, _State = #state{conn_pid = ConnPid}) when is_pid(ConnPid) ->
|
terminate(Reason, State) ->
|
||||||
%% 取消topic的订阅
|
lager:warning("[iot_zd_consumer] terminate with reason: ~p, state: ~p", [Reason, State]),
|
||||||
TopicNames = lists:map(fun({Name, _}) -> Name end, ?Topics),
|
|
||||||
{ok, _Props, _ReasonCode} = emqtt:unsubscribe(ConnPid, #{}, TopicNames),
|
|
||||||
|
|
||||||
ok = emqtt:disconnect(ConnPid),
|
|
||||||
lager:debug("[iot_zd_consumer] terminate with reason: ~p", [Reason]),
|
|
||||||
ok;
|
|
||||||
terminate(Reason, _State) ->
|
|
||||||
lager:debug("[iot_zd_consumer] terminate with reason: ~p", [Reason]),
|
|
||||||
ok.
|
ok.
|
||||||
|
|
||||||
%% @private
|
%% @private
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user