fix: only set default for max_conn_rate and update test case
This revert the change in commit e291dcd
for all listener "short
path fields" except the field max_conn_rate so they no longer have a
default value. It also updates a test case that assume that no listener
config is created by default but this is no longer the case when there
is a default value for the max_conn_rate field.
This commit is contained in:
parent
82bb03a2a3
commit
d206d24975
|
@ -212,17 +212,29 @@ short_paths_fields() ->
|
||||||
short_paths_fields(Importance) ->
|
short_paths_fields(Importance) ->
|
||||||
[
|
[
|
||||||
{Name,
|
{Name,
|
||||||
?HOCON(rate_type(), #{
|
?HOCON(
|
||||||
desc => ?DESC(Name),
|
rate_type(),
|
||||||
required => false,
|
maps:merge(
|
||||||
default => infinity,
|
#{
|
||||||
importance => Importance,
|
desc => ?DESC(Name),
|
||||||
example => Example
|
required => false,
|
||||||
})}
|
importance => Importance,
|
||||||
|
example => Example
|
||||||
|
},
|
||||||
|
short_paths_fields_extra(Name)
|
||||||
|
)
|
||||||
|
)}
|
||||||
|| {Name, Example} <-
|
|| {Name, Example} <-
|
||||||
lists:zip(short_paths(), [<<"1000/s">>, <<"1000/s">>, <<"100MB/s">>])
|
lists:zip(short_paths(), [<<"1000/s">>, <<"1000/s">>, <<"100MB/s">>])
|
||||||
].
|
].
|
||||||
|
|
||||||
|
short_paths_fields_extra(max_conn_rate) ->
|
||||||
|
#{
|
||||||
|
default => infinity
|
||||||
|
};
|
||||||
|
short_paths_fields_extra(_Name) ->
|
||||||
|
#{}.
|
||||||
|
|
||||||
desc(limiter) ->
|
desc(limiter) ->
|
||||||
"Settings for the rate limiter.";
|
"Settings for the rate limiter.";
|
||||||
desc(node_opts) ->
|
desc(node_opts) ->
|
||||||
|
|
|
@ -816,8 +816,8 @@ t_no_limiter_for_listener(_) ->
|
||||||
CfgStr = <<>>,
|
CfgStr = <<>>,
|
||||||
ok = emqx_common_test_helpers:load_config(emqx_schema, CfgStr),
|
ok = emqx_common_test_helpers:load_config(emqx_schema, CfgStr),
|
||||||
ListenerOpt = emqx:get_config([listeners, tcp, default]),
|
ListenerOpt = emqx:get_config([listeners, tcp, default]),
|
||||||
?assertEqual(
|
?assertMatch(
|
||||||
undefined,
|
#{connection := #{rate := infinity}},
|
||||||
emqx_limiter_utils:get_listener_opts(ListenerOpt)
|
emqx_limiter_utils:get_listener_opts(ListenerOpt)
|
||||||
).
|
).
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue