Explorar o código

fix(emqx): check if the congestion alarm was sent before clearing (#4824)

Shawn %!s(int64=4) %!d(string=hai) anos
pai
achega
97e27faf05
Modificáronse 2 ficheiros con 8 adicións e 1 borrados
  1. 4 0
      src/emqx.appup.src
  2. 4 1
      src/emqx_congestion.erl

+ 4 - 0
src/emqx.appup.src

@@ -2,10 +2,12 @@
 {VSN,
  [
    {"4.3.1", [
+     {load_module, emqx_congestion, brutal_purge, soft_purge, []},
      {load_module, emqx_node_dump, brutal_purge, soft_purge, []}
    ]},
    {"4.3.0", [
      {load_module, emqx_logger_jsonfmt, brutal_purge, soft_purge, []},
+     {load_module, emqx_congestion, brutal_purge, soft_purge, []},
      {load_module, emqx_connection, brutal_purge, soft_purge, []},
      {load_module, emqx_frame, brutal_purge, soft_purge, []},
      {load_module, emqx_trie, brutal_purge, soft_purge, []},
@@ -16,11 +18,13 @@
  ],
  [
    {"4.3.1", [
+     {load_module, emqx_congestion, brutal_purge, soft_purge, []},
      {load_module, emqx_node_dump, brutal_purge, soft_purge, []}
    ]},
    {"4.3.0", [
      {load_module, emqx_logger_jsonfmt, brutal_purge, soft_purge, []},
      {load_module, emqx_connection, brutal_purge, soft_purge, []},
+     {load_module, emqx_congestion, brutal_purge, soft_purge, []},
      {load_module, emqx_frame, brutal_purge, soft_purge, []},
      {load_module, emqx_trie, brutal_purge, soft_purge, []},
      %% Just load the module. We don't need to change the 'messages.retained'

+ 4 - 1
src/emqx_congestion.erl

@@ -48,7 +48,10 @@ maybe_alarm_conn_congestion(Socket, Transport, Channel) ->
 
 cancel_alarms(Socket, Transport, Channel) ->
     lists:foreach(fun(Reason) ->
-        do_cancel_alarm_congestion(Socket, Transport, Channel, Reason)
+        case has_alarm_sent(Reason) of
+            true -> do_cancel_alarm_congestion(Socket, Transport, Channel, Reason);
+            false -> ok
+        end
     end, ?ALL_ALARM_REASONS).
 
 is_alarm_enabled(Channel) ->