fix(congestion): alarm and clear congestion too frequetly
This commit is contained in:
parent
238eaa8e40
commit
6666210211
|
@ -38,7 +38,7 @@
|
||||||
-define(ALARM_SENT(REASON), {alarm_sent, REASON}).
|
-define(ALARM_SENT(REASON), {alarm_sent, REASON}).
|
||||||
-define(ALL_ALARM_REASONS, [port_busy, too_many_publish]).
|
-define(ALL_ALARM_REASONS, [port_busy, too_many_publish]).
|
||||||
-define(CONFIRM_CLEAR(REASON), {alarm_confirm_clear, REASON}).
|
-define(CONFIRM_CLEAR(REASON), {alarm_confirm_clear, REASON}).
|
||||||
-define(CONFIRM_CLEAR_INTERVAL, 10000).
|
-define(CONFIRM_CLEAR_INTERVAL, 60000).
|
||||||
|
|
||||||
maybe_alarm_port_busy(Socket, Transport, Channel) ->
|
maybe_alarm_port_busy(Socket, Transport, Channel) ->
|
||||||
maybe_alarm_port_busy(Socket, Transport, Channel, false).
|
maybe_alarm_port_busy(Socket, Transport, Channel, false).
|
||||||
|
|
|
@ -551,9 +551,9 @@ handle_timeout(_TRef, limit_timeout, State) ->
|
||||||
handle_timeout(_TRef, emit_stats, State = #state{active_n = MaxBatchSize,
|
handle_timeout(_TRef, emit_stats, State = #state{active_n = MaxBatchSize,
|
||||||
channel = Channel, transport = Transport, socket = Socket}) ->
|
channel = Channel, transport = Transport, socket = Socket}) ->
|
||||||
{_, MsgQLen} = erlang:process_info(self(), message_queue_len),
|
{_, MsgQLen} = erlang:process_info(self(), message_queue_len),
|
||||||
emqx_congestion:maybe_alarm_port_busy(Socket, Transport, Channel, true),
|
emqx_congestion:maybe_alarm_port_busy(Socket, Transport, Channel),
|
||||||
emqx_congestion:maybe_alarm_too_many_publish(Socket, Transport, Channel,
|
emqx_congestion:maybe_alarm_too_many_publish(Socket, Transport, Channel,
|
||||||
MsgQLen, MaxBatchSize, true),
|
MsgQLen, MaxBatchSize),
|
||||||
ClientId = emqx_channel:info(clientid, Channel),
|
ClientId = emqx_channel:info(clientid, Channel),
|
||||||
emqx_cm:set_chan_stats(ClientId, stats(State)),
|
emqx_cm:set_chan_stats(ClientId, stats(State)),
|
||||||
{ok, State#state{stats_timer = undefined}};
|
{ok, State#state{stats_timer = undefined}};
|
||||||
|
|
Loading…
Reference in New Issue