Pārlūkot izejas kodu

fix(emqx): rename wont_clear_alarm_in to min_alarm_sustain_duration

Shawn 4 gadi atpakaļ
vecāks
revīzija
f902d880c1
3 mainītis faili ar 7 papildinājumiem un 6 dzēšanām
  1. 2 2
      etc/emqx.conf
  2. 3 3
      priv/emqx.schema
  3. 2 1
      src/emqx_congestion.erl

+ 2 - 2
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.

+ 3 - 3
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) ->

+ 2 - 1
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