Merge pull request #9133 from lafirest/fix/limiter_api
fix(limiter): add `limiter` back to the configs API
This commit is contained in:
commit
4cc13c4aa5
|
@ -107,14 +107,12 @@ insert_bucket(Id, Type, Bucket) ->
|
||||||
delete_bucket(Type, Id) ->
|
delete_bucket(Type, Id) ->
|
||||||
ets:delete(?TAB, ?UID(Id, Type)).
|
ets:delete(?TAB, ?UID(Id, Type)).
|
||||||
|
|
||||||
|
post_config_update([limiter], _Config, NewConf, _OldConf, _AppEnvs) ->
|
||||||
|
Types = lists:delete(client, maps:keys(NewConf)),
|
||||||
|
_ = [on_post_config_update(Type, NewConf) || Type <- Types],
|
||||||
|
ok;
|
||||||
post_config_update([limiter, Type], _Config, NewConf, _OldConf, _AppEnvs) ->
|
post_config_update([limiter, Type], _Config, NewConf, _OldConf, _AppEnvs) ->
|
||||||
Config = maps:get(Type, NewConf),
|
on_post_config_update(Type, NewConf).
|
||||||
case emqx_limiter_server:whereis(Type) of
|
|
||||||
undefined ->
|
|
||||||
start_server(Type, Config);
|
|
||||||
_ ->
|
|
||||||
emqx_limiter_server:update_config(Type, Config)
|
|
||||||
end.
|
|
||||||
|
|
||||||
%%--------------------------------------------------------------------
|
%%--------------------------------------------------------------------
|
||||||
%% @doc
|
%% @doc
|
||||||
|
@ -258,3 +256,11 @@ format_status(_Opt, Status) ->
|
||||||
%%--------------------------------------------------------------------
|
%%--------------------------------------------------------------------
|
||||||
%% Internal functions
|
%% Internal functions
|
||||||
%%--------------------------------------------------------------------
|
%%--------------------------------------------------------------------
|
||||||
|
on_post_config_update(Type, NewConf) ->
|
||||||
|
Config = maps:get(Type, NewConf),
|
||||||
|
case emqx_limiter_server:whereis(Type) of
|
||||||
|
undefined ->
|
||||||
|
start_server(Type, Config);
|
||||||
|
_ ->
|
||||||
|
emqx_limiter_server:update_config(Type, Config)
|
||||||
|
end.
|
||||||
|
|
|
@ -63,7 +63,6 @@
|
||||||
<<"prometheus">>,
|
<<"prometheus">>,
|
||||||
<<"telemetry">>,
|
<<"telemetry">>,
|
||||||
<<"sys_topics">>,
|
<<"sys_topics">>,
|
||||||
<<"limiter">>,
|
|
||||||
<<"listeners">>
|
<<"listeners">>
|
||||||
] ++ global_zone_roots()
|
] ++ global_zone_roots()
|
||||||
).
|
).
|
||||||
|
@ -78,7 +77,6 @@ paths() ->
|
||||||
"/configs",
|
"/configs",
|
||||||
"/configs_reset/:rootname",
|
"/configs_reset/:rootname",
|
||||||
"/configs/global_zone"
|
"/configs/global_zone"
|
||||||
%% "/configs/limiter/:limiter_type"
|
|
||||||
] ++
|
] ++
|
||||||
lists:map(fun({Name, _Type}) -> ?PREFIX ++ binary_to_list(Name) end, config_list()).
|
lists:map(fun({Name, _Type}) -> ?PREFIX ++ binary_to_list(Name) end, config_list()).
|
||||||
|
|
||||||
|
@ -168,42 +166,6 @@ schema("/configs/global_zone") ->
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
%% schema("/configs/limiter/:limiter_type") ->
|
|
||||||
%% Schema = hoconsc:ref(emqx_limiter_schema, limiter_opts),
|
|
||||||
%% Parameters = [
|
|
||||||
%% {limiter_type,
|
|
||||||
%% hoconsc:mk(
|
|
||||||
%% hoconsc:enum(emqx_limiter_schema:types()),
|
|
||||||
%% #{
|
|
||||||
%% in => path,
|
|
||||||
%% required => true,
|
|
||||||
%% example => <<"bytes_in">>,
|
|
||||||
%% desc => <<"The limiter type">>
|
|
||||||
%% }
|
|
||||||
%% )}
|
|
||||||
%% ],
|
|
||||||
%% #{
|
|
||||||
%% 'operationId' => config,
|
|
||||||
%% get => #{
|
|
||||||
%% tags => ?TAGS,
|
|
||||||
%% description => <<"Get config of this limiter">>,
|
|
||||||
%% parameters => Parameters,
|
|
||||||
%% responses => #{
|
|
||||||
%% 200 => Schema,
|
|
||||||
%% 404 => emqx_dashboard_swagger:error_codes(['NOT_FOUND'], <<"config not found">>)
|
|
||||||
%% }
|
|
||||||
%% },
|
|
||||||
%% put => #{
|
|
||||||
%% tags => ?TAGS,
|
|
||||||
%% description => <<"Update config of this limiter">>,
|
|
||||||
%% parameters => Parameters,
|
|
||||||
%% 'requestBody' => Schema,
|
|
||||||
%% responses => #{
|
|
||||||
%% 200 => Schema,
|
|
||||||
%% 400 => emqx_dashboard_swagger:error_codes(['UPDATE_FAILED'])
|
|
||||||
%% }
|
|
||||||
%% }
|
|
||||||
%% };
|
|
||||||
schema(Path) ->
|
schema(Path) ->
|
||||||
{RootKey, {_Root, Schema}} = find_schema(Path),
|
{RootKey, {_Root, Schema}} = find_schema(Path),
|
||||||
#{
|
#{
|
||||||
|
|
|
@ -11,6 +11,8 @@
|
||||||
- Remove support for setting shared subscriptions using the non-standard `$queue` feature [#9412](https://github.com/emqx/emqx/pull/9412).
|
- Remove support for setting shared subscriptions using the non-standard `$queue` feature [#9412](https://github.com/emqx/emqx/pull/9412).
|
||||||
Shared subscriptions are now part of the MQTT spec. Use `$share` instead.
|
Shared subscriptions are now part of the MQTT spec. Use `$share` instead.
|
||||||
|
|
||||||
|
- Add `limiter` update API [#9133](https://github.com/emqx/emqx/pull/9133).
|
||||||
|
|
||||||
## Bug fixes
|
## Bug fixes
|
||||||
|
|
||||||
- Fix that the obsolete SSL files aren't deleted after the ExHook config update [#9432](https://github.com/emqx/emqx/pull/9432).
|
- Fix that the obsolete SSL files aren't deleted after the ExHook config update [#9432](https://github.com/emqx/emqx/pull/9432).
|
||||||
|
|
|
@ -11,6 +11,8 @@
|
||||||
|
|
||||||
- 支持在 Apple Silicon 架构下编译苹果系统的发行版本 [#9423](https://github.com/emqx/emqx/pull/9423)。
|
- 支持在 Apple Silicon 架构下编译苹果系统的发行版本 [#9423](https://github.com/emqx/emqx/pull/9423)。
|
||||||
|
|
||||||
|
- 添加 `limiter` 更新 API [#9133](https://github.com/emqx/emqx/pull/9133)。
|
||||||
|
|
||||||
## 修复
|
## 修复
|
||||||
|
|
||||||
- 修复 ExHook 更新 SSL 相关配置后,过时的 SSL 文件没有被删除的问题 [#9432](https://github.com/emqx/emqx/pull/9432)。
|
- 修复 ExHook 更新 SSL 相关配置后,过时的 SSL 文件没有被删除的问题 [#9432](https://github.com/emqx/emqx/pull/9432)。
|
||||||
|
|
Loading…
Reference in New Issue