pooler_starter_sup.erl 871 B

123456789101112131415161718192021222324252627282930313233
  1. %% @doc Simple one for one supervisor for pooler_starter.
  2. %%
  3. %% This supervisor is shared by all pools since pooler_starter is a
  4. %% generic helper to fasciliate async member start.
  5. -module(pooler_starter_sup).
  6. -behaviour(supervisor).
  7. -export([
  8. new_starter/1,
  9. start_link/0,
  10. init/1
  11. ]).
  12. -spec new_starter(pooler_starter:start_spec()) -> {ok, pid()}.
  13. new_starter(Spec) ->
  14. supervisor:start_child(?MODULE, [Spec]).
  15. start_link() ->
  16. supervisor:start_link({local, ?MODULE}, ?MODULE, []).
  17. init([]) ->
  18. Worker = #{
  19. id => pooler_starter,
  20. start => {pooler_starter, start_link, []},
  21. restart => temporary,
  22. shutdown => brutal_kill,
  23. type => worker,
  24. modules => [pooler_starter]
  25. },
  26. Specs = [Worker],
  27. Restart = #{strategy => simple_one_for_one, intensity => 1, period => 1},
  28. {ok, {Restart, Specs}}.