From f902d880c1b4fb7752deaa04c03d6ad3db55ed8b Mon Sep 17 00:00:00 2001 From: Shawn <506895667@qq.com> Date: Wed, 7 Apr 2021 09:19:11 +0800 Subject: [PATCH] fix(emqx): rename wont_clear_alarm_in to min_alarm_sustain_duration --- etc/emqx.conf | 4 ++-- priv/emqx.schema | 6 +++--- src/emqx_congestion.erl | 3 ++- 3 files changed, 7 insertions(+), 6 deletions(-) diff --git a/etc/emqx.conf b/etc/emqx.conf index 5927ad99d..81b5b6460 100644 --- a/etc/emqx.conf +++ b/etc/emqx.conf @@ -894,11 +894,11 @@ zone.external.enable_flapping_detect = off ## Won't clear the congested alarm in how long time. ## The alarm is cleared only when there're no pending bytes in the queue, and also it has been -## `wont_clear_alarm_in` time since the last time we considered the connection is "congested". +## `min_alarm_sustain_duration` time since the last time we considered the connection is "congested". ## ## This is to avoid clearing and sending the alarm again too often. ## Default: 1m -#zone.external.conn_congestion.wont_clear_alarm_in = 1m +#zone.external.conn_congestion.min_alarm_sustain_duration = 1m ## Messages quota for the each of external MQTT connection. ## This value consumed by the number of recipient on a message. diff --git a/priv/emqx.schema b/priv/emqx.schema index 9bffa6987..c9dc938cf 100644 --- a/priv/emqx.schema +++ b/priv/emqx.schema @@ -1020,7 +1020,7 @@ end}. {default, off} ]}. -{mapping, "zone.$name.conn_congestion.wont_clear_alarm_in", "emqx.zones", [ +{mapping, "zone.$name.conn_congestion.min_alarm_sustain_duration", "emqx.zones", [ {default, "1m"}, {datatype, {duration, ms}} ]}. @@ -1156,8 +1156,8 @@ end}. {ratelimit, {conn_bytes_in, Ratelimit(Val)}}; (["conn_congestion", "alarm"], Val) -> {conn_congestion_alarm_enabled, Val}; - (["conn_congestion", "wont_clear_alarm_in"], Val) -> - {conn_congestion_wont_clear_alarm_in, Val}; + (["conn_congestion", "min_alarm_sustain_duration"], Val) -> + {conn_congestion_min_alarm_sustain_duration, Val}; (["quota", "conn_messages_routing"], Val) -> {quota, {conn_messages_routing, Ratelimit(Val)}}; (["quota", "overall_messages_routing"], Val) -> diff --git a/src/emqx_congestion.erl b/src/emqx_congestion.erl index 14e5f6f6e..b210a2cc3 100644 --- a/src/emqx_congestion.erl +++ b/src/emqx_congestion.erl @@ -65,7 +65,8 @@ alarm_congestion(Socket, Transport, Channel, Reason) -> cancel_alarm_congestion(Socket, Transport, Channel, Reason) -> Zone = emqx_channel:info(zone, Channel), - WontClearIn = emqx_zone:get_env(Zone, conn_congestion_wont_clear_alarm_in, ?WONT_CLEAR_IN), + WontClearIn = emqx_zone:get_env(Zone, conn_congestion_min_alarm_sustain_duration, + ?WONT_CLEAR_IN), case has_alarm_sent(Reason) andalso long_time_since_last_alarm(Reason, WontClearIn) of true -> do_cancel_alarm_congestion(Socket, Transport, Channel, Reason); false -> ok