Move LDAP pool creation from app init to a boot step.

This commit is contained in:
Alex Thomas 2015-03-30 16:45:44 +01:00
parent 54ac8655d6
commit cf9789cf40
1 changed files with 12 additions and 11 deletions

View File

@ -21,7 +21,16 @@
%% Dummy supervisor to get this application behaviour working
-behaviour(supervisor).
-export([init/1]).
-export([create_ldap_pool/0, init/1]).
-rabbit_boot_step({ldap_pool,
[{description, "LDAP pool"},
{mfa, {?MODULE, create_ldap_pool, []}},
{requires, kernel_ready}]}).
create_ldap_pool() ->
{ok, PoolSize} = application:get_env(rabbitmq_auth_backend_ldap, pool_size),
rabbit_sup:start_supervisor_child(ldap_pool_sup, worker_pool_sup, [PoolSize, ldap_pool]).
start(_Type, _StartArgs) ->
{ok, Backends} = application:get_env(rabbit, auth_backends),
@ -50,13 +59,5 @@ configured(M, [_ |T]) -> configured(M, T).
%%----------------------------------------------------------------------------
init([]) ->
{ok, PoolSize} = application:get_env(rabbitmq_auth_backend_ldap, pool_size),
PoolSupSpec = {ldap_pool_sup,
{worker_pool_sup, start_link, [PoolSize, ldap_pool]},
permanent,
infinity,
supervisor,
[worker_pool_sup]},
{ok, {{one_for_all, 3, 10},
[PoolSupSpec]}}.
init([]) -> {ok, {{one_for_one, 3, 10}, []}}.