Review code

This commit is contained in:
turtled 2017-09-09 21:21:30 +08:00
parent 424aea2878
commit ee9fc5cb0e
1 changed files with 2 additions and 10 deletions

View File

@ -299,19 +299,11 @@ queue_config_callback([_, AppStr, KeyStr], Value) ->
queue_config_callback(App, low_watermark, Value) -> queue_config_callback(App, low_watermark, Value) ->
{ok, Env} = emqttd:env(App), {ok, Env} = emqttd:env(App),
Parse = fun(S) -> application:set_env(?APP, App, lists:keyreplace(low_watermark, 1, Env, {low_watermark, Value})),
{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)})),
" successfully\n"; " successfully\n";
queue_config_callback(App, high_watermark, Value) -> queue_config_callback(App, high_watermark, Value) ->
{ok, Env} = emqttd:env(App), {ok, Env} = emqttd:env(App),
Parse = fun(S) -> application:set_env(?APP, App, lists:keyreplace(high_watermark, 1, Env, {high_watermark, Value})),
{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)})),
" successfully\n"; " successfully\n";
queue_config_callback(App, Key, Value) -> queue_config_callback(App, Key, Value) ->
{ok, Env} = emqttd:env(App), {ok, Env} = emqttd:env(App),