style(elvis): avoid using if
This commit is contained in:
parent
24c55ab5cc
commit
7923f017be
|
@ -84,18 +84,17 @@ connection_quota_early_alarm({ok, #{max_connections := Max}}) when is_integer(Ma
|
||||||
Count = connection_count(),
|
Count = connection_count(),
|
||||||
Low = emqx_conf:get([license, connection_low_watermark], 0.75),
|
Low = emqx_conf:get([license, connection_low_watermark], 0.75),
|
||||||
High = emqx_conf:get([license, connection_high_watermark], 0.80),
|
High = emqx_conf:get([license, connection_high_watermark], 0.80),
|
||||||
if
|
Count > Max * High andalso
|
||||||
Count > Max * High ->
|
begin
|
||||||
HighPercent = float_to_binary(High * 100, [{decimals, 0}]),
|
HighPercent = float_to_binary(High * 100, [{decimals, 0}]),
|
||||||
Message = iolist_to_binary([
|
Message = iolist_to_binary([
|
||||||
"License: live connection number exceeds ", HighPercent, "%"
|
"License: live connection number exceeds ", HighPercent, "%"
|
||||||
]),
|
]),
|
||||||
catch emqx_alarm:activate(license_quota, #{high_watermark => HighPercent}, Message);
|
catch emqx_alarm:activate(license_quota, #{high_watermark => HighPercent}, Message)
|
||||||
Count < Max * Low ->
|
end,
|
||||||
catch emqx_alarm:deactivate(license_quota);
|
Count < Max * Low andalso
|
||||||
true ->
|
catch emqx_alarm:deactivate(license_quota),
|
||||||
ok
|
ok;
|
||||||
end;
|
|
||||||
connection_quota_early_alarm(_Limits) ->
|
connection_quota_early_alarm(_Limits) ->
|
||||||
ok.
|
ok.
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue