improve: rename quota option name
This commit is contained in:
parent
4233ef4e85
commit
f6b35d63f2
|
@ -863,25 +863,29 @@ zone.external.enable_flapping_detect = off
|
|||
##
|
||||
## Value: Number,Duration
|
||||
## Example: 100 messages per 10 seconds.
|
||||
#zone.external.rate_limit.conn_messages_in = 100, 10s
|
||||
#zone.external.rate_limit.conn_messages_in = 100,10s
|
||||
|
||||
## Bytes limit for a external MQTT connections.
|
||||
##
|
||||
## Value: Number,Duration
|
||||
## Example: 100KB incoming per 10 seconds.
|
||||
#zone.external.rate_limit.conn_bytes_in = 100KB, 10s
|
||||
#zone.external.rate_limit.conn_bytes_in = 100KB,10s
|
||||
|
||||
## Messages quota for the external MQTT connections. This value
|
||||
## consumed by the number of PUBLISH message forwarding times.
|
||||
##
|
||||
## This option allows you to configure up to 2 parameters that are split by '|'.
|
||||
## The former represents the quota per connection, while the latter represents
|
||||
## the quota for all external zone's connections.
|
||||
## Messages quota for the each of external MQTT connection.
|
||||
## This value consumed by the number of recipient on a message.
|
||||
##
|
||||
## Value: Number, Duration
|
||||
##
|
||||
## Example: 100 messaegs per 1s and 200000 messages per 1s in zone
|
||||
#zone.external.quota.routing.messages = 100,1s | 200000,1s
|
||||
## Example: 100 messaegs per 1s
|
||||
#zone.external.quota.conn_messages_routing = 100,1s
|
||||
|
||||
## Messages quota for the all of external MQTT connections.
|
||||
## This value consumed by the number of recipient on a message.
|
||||
##
|
||||
## Value: Number, Duration
|
||||
##
|
||||
## Example: 200000 messaegs per 1s
|
||||
#zone.external.quota.overall_messages_routing = 200000,1s
|
||||
|
||||
## All the topics will be prefixed with the mountpoint path if this option is enabled.
|
||||
##
|
||||
|
@ -2214,4 +2218,4 @@ alarm.size_limit = 1000
|
|||
## Default: 24h
|
||||
alarm.validity_period = 24h
|
||||
|
||||
{{ additional_configs }}
|
||||
{{ additional_configs }}
|
||||
|
|
|
@ -997,15 +997,19 @@ end}.
|
|||
{default, off}
|
||||
]}.
|
||||
|
||||
{mapping, "zone.$name.rate_limit.messages_in", "emqx.zones", [
|
||||
{mapping, "zone.$name.rate_limit.conn_messages_in", "emqx.zones", [
|
||||
{datatype, string}
|
||||
]}.
|
||||
|
||||
{mapping, "zone.$name.rate_limit.bytes_in", "emqx.zones", [
|
||||
{mapping, "zone.$name.rate_limit.conn_bytes_in", "emqx.zones", [
|
||||
{datatype, string}
|
||||
]}.
|
||||
|
||||
{mapping, "zone.$name.quota.routing.messages", "emqx.zones", [
|
||||
{mapping, "zone.$name.quota.conn_messages_routing", "emqx.zones", [
|
||||
{datatype, string}
|
||||
]}.
|
||||
|
||||
{mapping, "zone.$name.quota.overall_messages_routing", "emqx.zones", [
|
||||
{datatype, string}
|
||||
]}.
|
||||
|
||||
|
@ -1115,18 +1119,13 @@ end}.
|
|||
(["response_information"], Val) ->
|
||||
{response_information, iolist_to_binary(Val)};
|
||||
(["rate_limit", "conn_messages_in"], Val) ->
|
||||
{ratelimit, {conn_messages_in, Ratelimit(Val)}};
|
||||
{ratelimit, {conn_messages_in, Ratelimit(Val)}};
|
||||
(["rate_limit", "conn_bytes_in"], Val) ->
|
||||
{ratelimit, {conn_bytes_in, Ratelimit(Val)}};
|
||||
(["quota", "routing", "messages"], Val) ->
|
||||
Policy = case string:tokens(Val, "|") of
|
||||
[T] ->
|
||||
[{conn_messages_routing, Ratelimit(T)}];
|
||||
[T1, T2] ->
|
||||
[{conn_messages_routing, Ratelimit(T1)},
|
||||
{overall_messages_routing, Ratelimit(T2)}]
|
||||
end,
|
||||
{quota, Policy};
|
||||
{ratelimit, {conn_bytes_in, Ratelimit(Val)}};
|
||||
(["quota", "conn_messages_routing"], Val) ->
|
||||
{quota, {conn_messages_routing, Ratelimit(Val)}};
|
||||
(["quota", "overall_messages_routing"], Val) ->
|
||||
{quota, {overall_messages_routing, Ratelimit(Val)}};
|
||||
([Opt], Val) ->
|
||||
{list_to_atom(Opt), Val}
|
||||
end,
|
||||
|
@ -1137,9 +1136,10 @@ end}.
|
|||
maps:update_with(list_to_atom(Name),
|
||||
fun(Opts) ->
|
||||
case NVal of
|
||||
{ratelimit, Rl} ->
|
||||
Rls = proplists:get_value(ratelimit, Opts, []),
|
||||
lists:keystore(ratelimit, 1, Opts, {ratelimit, [Rl|Rls]});
|
||||
{Key, Rl} when Key == ratelimit;
|
||||
Key == quota ->
|
||||
Rls = proplists:get_value(Key, Opts, []),
|
||||
lists:keystore(Key, 1, Opts, {Key, [Rl|Rls]});
|
||||
_ ->
|
||||
[NVal|Opts]
|
||||
end
|
||||
|
|
Loading…
Reference in New Issue