refactor: use `emqx_pool:async_submit` to avoid excessive spawning

This commit is contained in:
Thales Macedo Garitezi 2023-07-20 09:40:30 -03:00
parent eb41b77de4
commit 3b1e436d3f
1 changed files with 1 additions and 1 deletions

View File

@ -824,7 +824,7 @@ reply_dropped(_ReplyTo = {Fn, Args, #{reply_dropped := true}}, Result) when
is_function(Fn), is_list(Args)
->
%% We want to avoid bumping metrics inside the buffer worker, since it's costly.
spawn(fun() -> erlang:apply(Fn, Args ++ [Result]) end),
emqx_pool:async_submit(Fn, Args ++ [Result]),
ok;
reply_dropped(_ReplyTo, _Result) ->
ok.