Merge pull request #6471 from lafirest/fix/quota_limiter

fix(emqx_limiter): update the overall limiter when config updating
This commit is contained in:
lafirest 2021-12-23 17:19:49 +08:00 committed by GitHub
commit f09bf74c99
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
3 changed files with 13 additions and 1 deletions

View File

@ -6,7 +6,7 @@
[{gproc, {git, "https://github.com/uwiger/gproc", {tag, "0.8.0"}}},
{jiffy, {git, "https://github.com/emqx/jiffy", {tag, "1.0.5"}}},
{cowboy, {git, "https://github.com/emqx/cowboy", {tag, "2.7.1"}}},
{esockd, {git, "https://github.com/emqx/esockd", {tag, "5.7.5"}}},
{esockd, {git, "https://github.com/emqx/esockd", {tag, "5.7.6"}}},
{ekka, {git, "https://github.com/emqx/ekka", {tag, "0.7.10"}}},
{gen_rpc, {git, "https://github.com/emqx/gen_rpc", {tag, "2.5.0"}}},
{cuttlefish, {git, "https://github.com/emqx/cuttlefish", {tag, "v3.0.0"}}}

View File

@ -128,6 +128,9 @@
{load_module, emqx_connection, brutal_purge, soft_purge, []},
{load_module, emqx_cm, brutal_purge, soft_purge, []}
]},
{<<"4.2.9">>, [
{load_module, emqx_zone, brutal_purge, soft_purge, []},
]},
{<<".*">>, []}
],
[
@ -257,6 +260,9 @@
{load_module, emqx_connection, brutal_purge, soft_purge, []},
{load_module, emqx_cm, brutal_purge, soft_purge, []}
]},
{<<"4.2.9">>, [
{load_module, emqx_zone, brutal_purge, soft_purge, []},
]},
{<<".*">>, []}
]
}.

View File

@ -243,6 +243,7 @@ get_env(Zone, Key, Def) ->
-spec(set_env(zone(), atom(), term()) -> ok).
set_env(Zone, Key, Val) ->
on_conf_update(Key, Val, Zone),
persistent_term:put(?KEY(Zone, Key), Val).
-spec(unset_env(zone(), atom()) -> boolean()).
@ -296,3 +297,8 @@ do_reload() ->
[persistent_term:put(?KEY(Zone, Key), Val)
|| {Zone, Opts} <- emqx:get_env(zones, []), {Key, Val} <- Opts].
on_conf_update(overall_messages_routing, {Capacity, Interval}, Zone) ->
esockd_limiter:update({Zone, overall_messages_routing}, Capacity, Interval),
ok;
on_conf_update(_, _, _) ->
ok.