From ee9fc5cb0e6b11f399e496ef16e129add8e402dc Mon Sep 17 00:00:00 2001 From: turtled Date: Sat, 9 Sep 2017 21:21:30 +0800 Subject: [PATCH] Review code --- src/emqttd_cli_config.erl | 12 ++---------- 1 file changed, 2 insertions(+), 10 deletions(-) diff --git a/src/emqttd_cli_config.erl b/src/emqttd_cli_config.erl index 4379200b1..332ef9a9d 100644 --- a/src/emqttd_cli_config.erl +++ b/src/emqttd_cli_config.erl @@ -299,19 +299,11 @@ queue_config_callback([_, AppStr, KeyStr], Value) -> queue_config_callback(App, low_watermark, Value) -> {ok, Env} = emqttd:env(App), - Parse = fun(S) -> - {match, [N]} = re:run(S, "^([0-9]+)%$", [{capture, all_but_first, list}]), - list_to_integer(N) / 100 - end, - application:set_env(?APP, App, lists:keyreplace(low_watermark, 1, Env, {low_watermark, Parse(Value)})), + application:set_env(?APP, App, lists:keyreplace(low_watermark, 1, Env, {low_watermark, Value})), " successfully\n"; queue_config_callback(App, high_watermark, Value) -> {ok, Env} = emqttd:env(App), - Parse = fun(S) -> - {match, [N]} = re:run(S, "^([0-9]+)%$", [{capture, all_but_first, list}]), - list_to_integer(N) / 100 - end, - application:set_env(?APP, App, lists:keyreplace(high_watermark, 1, Env, {high_watermark, Parse(Value)})), + application:set_env(?APP, App, lists:keyreplace(high_watermark, 1, Env, {high_watermark, Value})), " successfully\n"; queue_config_callback(App, Key, Value) -> {ok, Env} = emqttd:env(App),