From ef90a389c1d4b529dbb3444d005ff8785a290831 Mon Sep 17 00:00:00 2001 From: Christophe Romain Date: Mon, 25 Apr 2016 09:44:46 +0200 Subject: [PATCH] Fix use of pubsub node plugin when configured with default_node_config --- src/mod_pubsub.erl | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) diff --git a/src/mod_pubsub.erl b/src/mod_pubsub.erl index e42d5c058..a86155af8 100644 --- a/src/mod_pubsub.erl +++ b/src/mod_pubsub.erl @@ -254,10 +254,12 @@ init([ServerHost, Opts]) -> fun(A) when is_integer(A) andalso A >= 0 -> A end, ?MAXITEMS), MaxSubsNode = gen_mod:get_opt(max_subscriptions_node, Opts, fun(A) when is_integer(A) andalso A >= 0 -> A end, undefined), - DefaultNodeCfg = gen_mod:get_opt(default_node_config, Opts, - fun(A) when is_list(A) -> filter_node_options(A) end, []), pubsub_index:init(Host, ServerHost, Opts), {Plugins, NodeTree, PepMapping} = init_plugins(Host, ServerHost, Opts), + DefaultModule = plugin(Host, hd(Plugins)), + BaseOptions = DefaultModule:options(), + DefaultNodeCfg = gen_mod:get_opt(default_node_config, Opts, + fun(A) when is_list(A) -> filter_node_options(A, BaseOptions) end, []), mnesia:create_table(pubsub_last_item, [{ram_copies, [node()]}, {attributes, record_info(fields, pubsub_last_item)}]), @@ -3680,11 +3682,11 @@ node_plugin_options(Host, Type) -> Result -> Result end. -filter_node_options(Options) -> +filter_node_options(Options, BaseOptions) -> lists:foldl(fun({Key, Val}, Acc) -> DefaultValue = proplists:get_value(Key, Options, Val), [{Key, DefaultValue}|Acc] - end, [], node_flat:options()). + end, [], BaseOptions). node_owners_action(Host, Type, Nidx, []) -> case gen_mod:db_type(serverhost(Host), ?MODULE) of