Use emqttd_gc:reset_conn_gc_count/2 API

This commit is contained in:
Feng Lee 2017-02-23 17:40:50 +08:00
parent 5ef4fce141
commit 1e36750288
3 changed files with 4 additions and 4 deletions

View File

@ -149,7 +149,7 @@ prioritise_info(Msg, _Len, _State) ->
case Msg of {redeliver, _} -> 5; _ -> 0 end. case Msg of {redeliver, _} -> 5; _ -> 0 end.
handle_pre_hibernate(State) -> handle_pre_hibernate(State) ->
{hibernate, emit_stats(emqttd_gc:reset_conn_gc_count(State))}. {hibernate, emqttd_gc:reset_conn_gc_count(#client_state.force_gc_count, emit_stats(State))}.
handle_call(info, From, State = #client_state{proto_state = ProtoState}) -> handle_call(info, From, State = #client_state{proto_state = ProtoState}) ->
ProtoInfo = emqttd_protocol:info(ProtoState), ProtoInfo = emqttd_protocol:info(ProtoState),

View File

@ -341,7 +341,7 @@ prioritise_info(Msg, _Len, _State) ->
end. end.
handle_pre_hibernate(State) -> handle_pre_hibernate(State) ->
{hibernate, emit_stats(emqttd_gc:reset_conn_gc_count(State))}. {hibernate, emqttd_gc:reset_conn_gc_count(#state.force_gc_count, emit_stats(State))}.
handle_call({publish, Msg = #mqtt_message{qos = ?QOS_2, pktid = PacketId}}, _From, handle_call({publish, Msg = #mqtt_message{qos = ?QOS_2, pktid = PacketId}}, _From,
State = #state{awaiting_rel = AwaitingRel, State = #state{awaiting_rel = AwaitingRel,

View File

@ -112,8 +112,8 @@ prioritise_info(Msg, _Len, _State) ->
case Msg of {redeliver, _} -> 5; _ -> 0 end. case Msg of {redeliver, _} -> 5; _ -> 0 end.
handle_pre_hibernate(State = #wsclient_state{ws_pid = WsPid}) -> handle_pre_hibernate(State = #wsclient_state{ws_pid = WsPid}) ->
erlang:garbage_collect(WsPid),%%TODO: [{async, RequestId}]?? erlang:garbage_collect(WsPid),
{hibernate, emqttd_gc:reset_conn_gc_count(emit_stats(State))}. {hibernate, emqttd_gc:reset_conn_gc_count(#wsclient_state.force_gc_count, emit_stats(State))}.
handle_call(info, From, State = #wsclient_state{peername = Peername, handle_call(info, From, State = #wsclient_state{peername = Peername,
proto_state = ProtoState}) -> proto_state = ProtoState}) ->