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
|
## Value: Number,Duration
|
||||||
## Example: 100 messages per 10 seconds.
|
## 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.
|
## Bytes limit for a external MQTT connections.
|
||||||
##
|
##
|
||||||
## Value: Number,Duration
|
## Value: Number,Duration
|
||||||
## Example: 100KB incoming per 10 seconds.
|
## 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
|
## Messages quota for the each of external MQTT connection.
|
||||||
## consumed by the number of PUBLISH message forwarding times.
|
## This value consumed by the number of recipient on a message.
|
||||||
##
|
|
||||||
## 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.
|
|
||||||
##
|
##
|
||||||
## Value: Number, Duration
|
## Value: Number, Duration
|
||||||
##
|
##
|
||||||
## Example: 100 messaegs per 1s and 200000 messages per 1s in zone
|
## Example: 100 messaegs per 1s
|
||||||
#zone.external.quota.routing.messages = 100,1s | 200000,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.
|
## 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
|
## Default: 24h
|
||||||
alarm.validity_period = 24h
|
alarm.validity_period = 24h
|
||||||
|
|
||||||
{{ additional_configs }}
|
{{ additional_configs }}
|
||||||
|
|
|
@ -997,15 +997,19 @@ end}.
|
||||||
{default, off}
|
{default, off}
|
||||||
]}.
|
]}.
|
||||||
|
|
||||||
{mapping, "zone.$name.rate_limit.messages_in", "emqx.zones", [
|
{mapping, "zone.$name.rate_limit.conn_messages_in", "emqx.zones", [
|
||||||
{datatype, string}
|
{datatype, string}
|
||||||
]}.
|
]}.
|
||||||
|
|
||||||
{mapping, "zone.$name.rate_limit.bytes_in", "emqx.zones", [
|
{mapping, "zone.$name.rate_limit.conn_bytes_in", "emqx.zones", [
|
||||||
{datatype, string}
|
{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}
|
{datatype, string}
|
||||||
]}.
|
]}.
|
||||||
|
|
||||||
|
@ -1115,18 +1119,13 @@ end}.
|
||||||
(["response_information"], Val) ->
|
(["response_information"], Val) ->
|
||||||
{response_information, iolist_to_binary(Val)};
|
{response_information, iolist_to_binary(Val)};
|
||||||
(["rate_limit", "conn_messages_in"], 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) ->
|
(["rate_limit", "conn_bytes_in"], Val) ->
|
||||||
{ratelimit, {conn_bytes_in, Ratelimit(Val)}};
|
{ratelimit, {conn_bytes_in, Ratelimit(Val)}};
|
||||||
(["quota", "routing", "messages"], Val) ->
|
(["quota", "conn_messages_routing"], Val) ->
|
||||||
Policy = case string:tokens(Val, "|") of
|
{quota, {conn_messages_routing, Ratelimit(Val)}};
|
||||||
[T] ->
|
(["quota", "overall_messages_routing"], Val) ->
|
||||||
[{conn_messages_routing, Ratelimit(T)}];
|
{quota, {overall_messages_routing, Ratelimit(Val)}};
|
||||||
[T1, T2] ->
|
|
||||||
[{conn_messages_routing, Ratelimit(T1)},
|
|
||||||
{overall_messages_routing, Ratelimit(T2)}]
|
|
||||||
end,
|
|
||||||
{quota, Policy};
|
|
||||||
([Opt], Val) ->
|
([Opt], Val) ->
|
||||||
{list_to_atom(Opt), Val}
|
{list_to_atom(Opt), Val}
|
||||||
end,
|
end,
|
||||||
|
@ -1137,9 +1136,10 @@ end}.
|
||||||
maps:update_with(list_to_atom(Name),
|
maps:update_with(list_to_atom(Name),
|
||||||
fun(Opts) ->
|
fun(Opts) ->
|
||||||
case NVal of
|
case NVal of
|
||||||
{ratelimit, Rl} ->
|
{Key, Rl} when Key == ratelimit;
|
||||||
Rls = proplists:get_value(ratelimit, Opts, []),
|
Key == quota ->
|
||||||
lists:keystore(ratelimit, 1, Opts, {ratelimit, [Rl|Rls]});
|
Rls = proplists:get_value(Key, Opts, []),
|
||||||
|
lists:keystore(Key, 1, Opts, {Key, [Rl|Rls]});
|
||||||
_ ->
|
_ ->
|
||||||
[NVal|Opts]
|
[NVal|Opts]
|
||||||
end
|
end
|
||||||
|
|
Loading…
Reference in New Issue