Fix unsubscribe bug

This commit is contained in:
Feng Lee 2018-08-25 16:03:28 +08:00
parent 4af6065984
commit 1aee05ce16
1 changed files with 1 additions and 2 deletions

View File

@ -433,7 +433,7 @@ handle_cast({subscribe, From, {PacketId, Properties, TopicFilters}},
handle_cast({unsubscribe, From, {PacketId, _Properties, TopicFilters}},
State = #state{client_id = ClientId, subscriptions = Subscriptions}) ->
{ReasonCodes, Subscriptions1} =
lists:foldr(fun(Topic, {RcAcc, SubMap}) ->
lists:foldr(fun({Topic, _Opts}, {RcAcc, SubMap}) ->
case maps:find(Topic, SubMap) of
{ok, SubOpts} ->
emqx_broker:unsubscribe(Topic, ClientId),
@ -649,7 +649,6 @@ retry_delivery(Force, State = #state{inflight = Inflight}) ->
State;
false ->
Msgs = lists:sort(sortfun(inflight), emqx_inflight:values(Inflight)),
io:format("!!! Retry Delivery: ~p~n", [Msgs]),
retry_delivery(Force, Msgs, os:timestamp(), State)
end.