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

fix(dialyzer): unmatched results in emqx_statsd_api

Shawn 4 лет назад
Родитель
Сommit
59e2614574
1 измененных файлов с 3 добавлено и 5 удалено
  1. 3 5
      apps/emqx_statsd/src/emqx_statsd_api.erl

+ 3 - 5
apps/emqx_statsd/src/emqx_statsd_api.erl

@@ -59,12 +59,10 @@ statsd(put, #{body := Body}) ->
                             Body,
                             #{rawconf_with_defaults => true, override_to => cluster}) of
         {ok, #{raw_config := NewConfig, config := Config}} ->
+            _ = emqx_statsd_sup:stop_child(?APP),
             case maps:get(<<"enable">>, Body) of
-                true ->
-                    _ = emqx_statsd_sup:stop_child(?APP),
-                    emqx_statsd_sup:start_child(?APP, maps:get(config, Config));
-                false ->
-                    _ = emqx_statsd_sup:stop_child(?APP)
+                true -> emqx_statsd_sup:start_child(?APP, maps:get(config, Config));
+                false -> ok
             end,
             {200, NewConfig};
         {error, Reason} ->