From f59443eaee70a26c7ac36b95355a82ff66e43abe Mon Sep 17 00:00:00 2001 From: Shawn <506895667@qq.com> Date: Thu, 16 Jun 2022 09:16:43 +0800 Subject: [PATCH] fix: add macro HP_HIGHEST=1000 --- apps/emqx/include/emqx_hooks.hrl | 34 ++++++++++--------- apps/emqx/test/props/prop_emqx_sys.erl | 2 +- apps/emqx_plugins/test/emqx_plugins_SUITE.erl | 2 +- 3 files changed, 20 insertions(+), 18 deletions(-) diff --git a/apps/emqx/include/emqx_hooks.hrl b/apps/emqx/include/emqx_hooks.hrl index 08fa07bc8..3785a13de 100644 --- a/apps/emqx/include/emqx_hooks.hrl +++ b/apps/emqx/include/emqx_hooks.hrl @@ -16,23 +16,25 @@ %% Definitions for Hook Priorities -%% == Highest Priority --define(HP_PSK, 1000). --define(HP_REWRITE, 1000). --define(HP_AUTHN, 990). --define(HP_AUTHZ, 980). --define(HP_SYS_MSGS, 960). --define(HP_TOPIC_METRICS, 950). --define(HP_RETAINER, 940). --define(HP_AUTO_SUB, 930). +%% Highest Priority = 1000, don't change this value as the plugins may depend on it. +-define(HP_HIGHEST, 1000). +%% hooks used by the emqx core app +-define(HP_PSK, 990). +-define(HP_REWRITE, 980). +-define(HP_AUTHN, 970). +-define(HP_AUTHZ, 960). +-define(HP_SYS_MSGS, 950). +-define(HP_TOPIC_METRICS, 940). +-define(HP_RETAINER, 930). +-define(HP_AUTO_SUB, 920). -define(HP_RULE_ENGINE, 900). - %% apps that can work with the republish action --define(HP_SLOW_SUB, 980). --define(HP_BRIDGE, 970). --define(HP_DELAY_PUB, 960). - -%% apps that can stop the hooks +-define(HP_SLOW_SUB, 880). +-define(HP_BRIDGE, 870). +-define(HP_DELAY_PUB, 860). +%% apps that can stop the hooks chain from continuing -define(HP_EXHOOK, 100). -%% == Lowest Priority + +%% == Lowest Priority = 0, don't change this value as the plugins may depend on it. +-define(HP_LOWEST, 0). diff --git a/apps/emqx/test/props/prop_emqx_sys.erl b/apps/emqx/test/props/prop_emqx_sys.erl index c3a091ce3..c554cbcdf 100644 --- a/apps/emqx/test/props/prop_emqx_sys.erl +++ b/apps/emqx/test/props/prop_emqx_sys.erl @@ -114,7 +114,7 @@ do_mock(mria_mnesia) -> do_mock(emqx_metrics) -> meck:expect(emqx_metrics, all, fun() -> [{hello, 3}] end); do_mock(emqx_hooks) -> - meck:expect(emqx_hooks, put, fun(_HookPoint, _MFA) -> ok end), + meck:expect(emqx_hooks, put, fun(_HookPoint, _MFA, _) -> ok end), meck:expect(emqx_hooks, del, fun(_HookPoint, _MF) -> ok end); do_mock(emqx_config_handler) -> meck:expect(emqx_config_handler, add_handler, fun(_, _) -> ok end). diff --git a/apps/emqx_plugins/test/emqx_plugins_SUITE.erl b/apps/emqx_plugins/test/emqx_plugins_SUITE.erl index 317519124..39eea5fc2 100644 --- a/apps/emqx_plugins/test/emqx_plugins_SUITE.erl +++ b/apps/emqx_plugins/test/emqx_plugins_SUITE.erl @@ -22,7 +22,7 @@ -include_lib("emqx/include/emqx.hrl"). -include_lib("eunit/include/eunit.hrl"). --define(EMQX_PLUGIN_TEMPLATE_VSN, "5.0-rc.1"). +-define(EMQX_PLUGIN_TEMPLATE_VSN, "5.0.0-rc.3"). -define(EMQX_ELIXIR_PLUGIN_TEMPLATE_VSN, "0.1.0"). -define(PACKAGE_SUFFIX, ".tar.gz").