Skip to content

Commit

Permalink
Fix use of pubsub node plugin when configured with default_node_config
Browse files Browse the repository at this point in the history
  • Loading branch information
Christophe Romain committed Apr 25, 2016
1 parent 65ad70d commit ef90a38
Showing 1 changed file with 6 additions and 4 deletions.
10 changes: 6 additions & 4 deletions src/mod_pubsub.erl
Original file line number Diff line number Diff line change
Expand Up @@ -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)}]),
Expand Down Expand Up @@ -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
Expand Down

0 comments on commit ef90a38

Please sign in to comment.