diff options
author | Evgeny Khramtsov <ekhramtsov@process-one.net> | 2019-08-04 21:46:18 +0300 |
---|---|---|
committer | Evgeny Khramtsov <ekhramtsov@process-one.net> | 2019-08-04 21:46:18 +0300 |
commit | 2168489ddf96a88d4b4885a1a0a986acb25754c5 (patch) | |
tree | 6eb6aa952467a4b30977d603cd05c6644c259893 /src/mod_muc_sup.erl | |
parent | Use tagged version for yconf as well (diff) |
Don't retain module option on gen_mod supervisor
When module's options were updated (e.g. by reloading ejabberd.yml)
and, later, the module's process crashed, gen_mod supervisor
restarts the process with outdated options. This is now fixed.
Diffstat (limited to '')
-rw-r--r-- | src/mod_muc_sup.erl | 14 |
1 files changed, 7 insertions, 7 deletions
diff --git a/src/mod_muc_sup.erl b/src/mod_muc_sup.erl index 0e5e75cb..99c2620c 100644 --- a/src/mod_muc_sup.erl +++ b/src/mod_muc_sup.erl @@ -23,25 +23,25 @@ -behaviour(supervisor). %% API --export([start/2, start_link/2, procname/1]). +-export([start/1, start_link/1, procname/1]). %% Supervisor callbacks -export([init/1]). %%%=================================================================== %%% API functions %%%=================================================================== -start(Host, Opts) -> +start(Host) -> Spec = #{id => procname(Host), - start => {?MODULE, start_link, [Host, Opts]}, + start => {?MODULE, start_link, [Host]}, restart => permanent, shutdown => infinity, type => supervisor, modules => [?MODULE]}, supervisor:start_child(ejabberd_gen_mod_sup, Spec). -start_link(Host, Opts) -> +start_link(Host) -> Proc = procname(Host), - supervisor:start_link({local, Proc}, ?MODULE, [Host, Opts]). + supervisor:start_link({local, Proc}, ?MODULE, [Host]). -spec procname(binary()) -> atom(). procname(Host) -> @@ -50,12 +50,12 @@ procname(Host) -> %%%=================================================================== %%% Supervisor callbacks %%%=================================================================== -init([Host, Opts]) -> +init([Host]) -> Cores = erlang:system_info(logical_processors), Specs = lists:foldl( fun(I, Acc) -> [#{id => mod_muc:procname(Host, I), - start => {mod_muc, start_link, [Host, Opts, I]}, + start => {mod_muc, start_link, [Host, I]}, restart => permanent, shutdown => timer:minutes(1), type => worker, |