Merge remote-tracking branch 'origin/release-v43' into release-v44

This commit is contained in:
Zaiming (Stone) Shi 2022-10-11 22:54:25 +02:00
commit 7d24c34db5
3 changed files with 24 additions and 1 deletions

View File

@ -525,7 +525,7 @@ esac
if [ "$IS_BOOT_COMMAND" = 'no' ]; then
# for non-boot commands, inspect vm.<time>.args for node name
# shellcheck disable=SC2012,SC2086
# shellcheck disable=SC2012
LATEST_VM_ARGS_FILE="$(ls -t "$RUNNER_DATA_DIR"/configs/vm.*.args 2>/dev/null | head -1)"
if [ -z "$LATEST_VM_ARGS_FILE" ]; then
echoerr "There is no vm.*.args config file found in '$RUNNER_DATA_DIR/configs/'"

View File

@ -227,6 +227,7 @@ shutdown() ->
shutdown(normal).
shutdown(Reason) ->
ok = emqx_misc:maybe_mute_rpc_log(),
?LOG(critical, "emqx shutdown for ~s", [Reason]),
on_shutdown(Reason),
_ = emqx_plugins:unload(),

View File

@ -25,6 +25,7 @@
-export([ merge_opts/2
, maybe_apply/2
, maybe_mute_rpc_log/0
, compose/1
, compose/2
, run_fold/3
@ -446,6 +447,27 @@ do_parallel_map(Fun, List) ->
PidList
).
%% @doc Call this function to avoid logs printed to RPC caller node.
-spec maybe_mute_rpc_log() -> ok.
maybe_mute_rpc_log() ->
GlNode = node(group_leader()),
maybe_mute_rpc_log(GlNode).
maybe_mute_rpc_log(Node) when Node =:= node() ->
%% do nothing, this is a local call
ok;
maybe_mute_rpc_log(Node) ->
case atom_to_list(Node) of
"remsh_" ++ _ ->
%% this is either an upgrade script or nodetool
%% do nothing, the log may go to the 'emqx' command line console
ok;
_ ->
%% otherwise set group leader to local node
_ = group_leader(whereis(init), self()),
ok
end.
-ifdef(TEST).
-include_lib("eunit/include/eunit.hrl").