Просмотр исходного кода

chore(dashboard): warning wehn stop dashboard listener not found.

zhongwencool 4 лет назад
Родитель
Сommit
8041524d20

+ 7 - 3
apps/emqx_dashboard/src/emqx_dashboard.erl

@@ -80,9 +80,13 @@ start_listeners() ->
 
 stop_listeners() ->
     [begin
-        _ = minirest:stop(Name),
-        ?ULOG("Stop listener ~ts on ~p successfully.~n", [Name, Port])
-    end || {Name, _, Port, _} <- listeners()].
+        case minirest:stop(Name) of
+            ok ->
+                ?ULOG("Stop listener ~ts on ~p successfully.~n", [Name, Port]);
+            {error, not_found} ->
+                ?SLOG(warning, #{msg => "stop_listener_failed", name => Name, port => Port})
+        end
+     end || {Name, _, Port, _} <- listeners()].
 
 %%--------------------------------------------------------------------
 %% internal

+ 2 - 2
apps/emqx_dashboard/src/emqx_dashboard_schema.erl

@@ -29,8 +29,8 @@ fields("dashboard") ->
         sc(hoconsc:array(hoconsc:union([hoconsc:ref(?MODULE, "http"),
             hoconsc:ref(?MODULE, "https")])),
             #{ desc =>
-"""HTTP(s) listeners identified by their protocol type,
-is used to serve dashboard UI and restful HTTP API.<br>
+"""HTTP(s) listeners are identified by their protocol type and are
+used to serve dashboard UI and restful HTTP API.<br>
 Listeners must have a unique combination of port number and IP address.<br>
 For example, an HTTP listener can listen on all configured IP addresses
 on a given port for a machine by specifying the IP address 0.0.0.0.<br>

+ 1 - 1
mix.exs

@@ -48,7 +48,7 @@ defmodule EMQXUmbrella.MixProject do
       {:mria, github: "emqx/mria", tag: "0.1.5", override: true},
       {:ekka, github: "emqx/ekka", tag: "0.11.3", override: true},
       {:gen_rpc, github: "emqx/gen_rpc", tag: "2.8.0", override: true},
-      {:minirest, github: "emqx/minirest", tag: "1.2.10", override: true},
+      {:minirest, github: "emqx/minirest", tag: "1.2.11", override: true},
       {:ecpool, github: "emqx/ecpool", tag: "0.5.2"},
       {:replayq, "0.3.3", override: true},
       {:pbkdf2, github: "emqx/erlang-pbkdf2", tag: "2.0.4", override: true},