Merge branch 'master' into global-gc-interval
This commit is contained in:
commit
2fbd6c9690
|
@ -103,7 +103,13 @@ cast(Msg) -> gen_server:cast(?SERVER, Msg).
|
||||||
run_command([]) ->
|
run_command([]) ->
|
||||||
run_command(help, []);
|
run_command(help, []);
|
||||||
run_command([Cmd | Args]) ->
|
run_command([Cmd | Args]) ->
|
||||||
run_command(list_to_atom(Cmd), Args).
|
case emqx_misc:safe_to_existing_atom(Cmd) of
|
||||||
|
{ok, Cmd1} ->
|
||||||
|
run_command(Cmd1, Args);
|
||||||
|
_ ->
|
||||||
|
help(),
|
||||||
|
{error, cmd_not_found}
|
||||||
|
end.
|
||||||
|
|
||||||
-spec run_command(cmd(), list(string())) -> ok | {error, term()}.
|
-spec run_command(cmd(), list(string())) -> ok | {error, term()}.
|
||||||
run_command(help, []) ->
|
run_command(help, []) ->
|
||||||
|
@ -220,12 +226,13 @@ init([]) ->
|
||||||
handle_call({register_command, Cmd, MF, Opts}, _From, State = #state{seq = Seq}) ->
|
handle_call({register_command, Cmd, MF, Opts}, _From, State = #state{seq = Seq}) ->
|
||||||
case ets:match(?CMD_TAB, {{'$1', Cmd}, '_', '_'}) of
|
case ets:match(?CMD_TAB, {{'$1', Cmd}, '_', '_'}) of
|
||||||
[] ->
|
[] ->
|
||||||
ets:insert(?CMD_TAB, {{Seq, Cmd}, MF, Opts});
|
ets:insert(?CMD_TAB, {{Seq, Cmd}, MF, Opts}),
|
||||||
|
{reply, ok, next_seq(State)};
|
||||||
[[OriginSeq] | _] ->
|
[[OriginSeq] | _] ->
|
||||||
?SLOG(warning, #{msg => "CMD_overidden", cmd => Cmd, mf => MF}),
|
?SLOG(warning, #{msg => "CMD_overidden", cmd => Cmd, mf => MF}),
|
||||||
true = ets:insert(?CMD_TAB, {{OriginSeq, Cmd}, MF, Opts})
|
true = ets:insert(?CMD_TAB, {{OriginSeq, Cmd}, MF, Opts}),
|
||||||
end,
|
{reply, ok, State}
|
||||||
{reply, ok, next_seq(State)};
|
end;
|
||||||
handle_call(Req, _From, State) ->
|
handle_call(Req, _From, State) ->
|
||||||
?SLOG(error, #{msg => "unexpected_call", call => Req}),
|
?SLOG(error, #{msg => "unexpected_call", call => Req}),
|
||||||
{reply, ignored, State}.
|
{reply, ignored, State}.
|
||||||
|
|
|
@ -4,4 +4,6 @@
|
||||||
|
|
||||||
- Disable global garbage collection by `node.global_gc_interval = disabled` [#9418](https://github.com/emqx/emqx/pull/9418)。
|
- Disable global garbage collection by `node.global_gc_interval = disabled` [#9418](https://github.com/emqx/emqx/pull/9418)。
|
||||||
|
|
||||||
|
- Improve the CLI to avoid waste atom table when typing erros [#9416](https://github.com/emqx/emqx/pull/9416).
|
||||||
|
|
||||||
## Bug fixes
|
## Bug fixes
|
||||||
|
|
|
@ -5,3 +5,6 @@
|
||||||
- 通过 `node.global_gc_interval = disabled` 来禁用全局垃圾回收 [#9418](https://github.com/emqx/emqx/pull/9418)。
|
- 通过 `node.global_gc_interval = disabled` 来禁用全局垃圾回收 [#9418](https://github.com/emqx/emqx/pull/9418)。
|
||||||
|
|
||||||
## 修复
|
## 修复
|
||||||
|
|
||||||
|
- 优化命令行实现, 避免输入错误指令时, 产生不必要的原子表消耗 [#9416](https://github.com/emqx/emqx/pull/9416)。
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue