diff options
author | Christophe Romain <christophe.romain@process-one.net> | 2016-04-25 09:44:46 +0200 |
---|---|---|
committer | Christophe Romain <christophe.romain@process-one.net> | 2016-04-25 09:44:46 +0200 |
commit | ef90a389c1d4b529dbb3444d005ff8785a290831 (patch) | |
tree | 148030ccd71affd4ea4a3d859609d347a073a1f4 /src | |
parent | Fix error text for message bounces (diff) |
Fix use of pubsub node plugin when configured with default_node_config
Diffstat (limited to 'src')
-rw-r--r-- | src/mod_pubsub.erl | 10 |
1 files changed, 6 insertions, 4 deletions
diff --git a/src/mod_pubsub.erl b/src/mod_pubsub.erl index e42d5c05..a86155af 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 |