db_sup.erl 531 B

1234567891011121314151617181920212223
  1. -module(db_sup).
  2. -behaviour(supervisor).
  3. -export([start_link/0]).
  4. -export([init/1]).
  5. -define(CHILD(I, Type), {I, {I, start_link, []}, permanent, 5000, Type, [I]}).
  6. start_link() ->
  7. supervisor:start_link({local, ?MODULE}, ?MODULE, []).
  8. init([]) ->
  9. RestartStrategy = one_for_one,
  10. MaxRestarts = 1000,
  11. MaxSecondsBetweenRestarts = 3600,
  12. SupFlags = {RestartStrategy, MaxRestarts, MaxSecondsBetweenRestarts},
  13. Restart = permanent,
  14. Shutdown = 2000,
  15. Type = worker,
  16. {ok, { {one_for_one, 5, 10}, []} }.