Fix set_chan_stats incorrect

This commit is contained in:
terry-xiaoyu 2019-09-05 15:59:18 +08:00
parent 4ba92b6a3b
commit 983973c841
2 changed files with 2 additions and 2 deletions

View File

@ -655,7 +655,7 @@ handle_call(Req, Channel) ->
handle_cast({register, Attrs, Stats}, #channel{client = #{client_id := ClientId}}) -> handle_cast({register, Attrs, Stats}, #channel{client = #{client_id := ClientId}}) ->
ok = emqx_cm:register_channel(ClientId), ok = emqx_cm:register_channel(ClientId),
emqx_cm:set_chan_attrs(ClientId, Attrs), emqx_cm:set_chan_attrs(ClientId, Attrs),
emqx_cm:set_chan_attrs(ClientId, Stats); emqx_cm:set_chan_stats(ClientId, Stats);
handle_cast(Msg, Channel) -> handle_cast(Msg, Channel) ->
?LOG(error, "Unexpected cast: ~p", [Msg]), ?LOG(error, "Unexpected cast: ~p", [Msg]),

View File

@ -100,7 +100,7 @@ t_cm(_) ->
emqtt:subscribe(C, <<"mytopic">>, 0), emqtt:subscribe(C, <<"mytopic">>, 0),
ct:sleep(1200), ct:sleep(1200),
Stats = emqx_cm:get_chan_stats(ClientId), Stats = emqx_cm:get_chan_stats(ClientId),
?assertEqual(1, proplists:get_value(subscriptions, Stats)), ?assertEqual(1, proplists:get_value(subscriptions_cnt, Stats)),
emqx_zone:set_env(external, idle_timeout, IdleTimeout). emqx_zone:set_env(external, idle_timeout, IdleTimeout).
t_cm_registry(_) -> t_cm_registry(_) ->