Skip to content

Instantly share code, notes, and snippets.

@elbrujohalcon
Last active October 29, 2016 05:01
Show Gist options
  • Save elbrujohalcon/3774b4b82edd7c785914d9cecb71a379 to your computer and use it in GitHub Desktop.
Save elbrujohalcon/3774b4b82edd7c785914d9cecb71a379 to your computer and use it in GitHub Desktop.
-module(world_sup).
-behaviour(supervisor).
-export([start_link/0, init/1]).
start_link() -> supervisor:start_link({local, ?MODULE}, ?MODULE, noargs).
init(noargs) ->
SupFlags = #{ strategy => one_for_one
, intensity => 100 % restarts in ...
, period => 1 % second
},
ChildSpecs = [#{ id => dodos_sup
, start => {animals_sup, start_link, [dodos]}
, restart => transient
, type => supervisor
}
, #{ id => cockroaches_sup
, start => {animals_sup, start_link, [cockroaches]}
, restart => permanent
, type => supervisor
}
],
{ok, {SupFlags, ChildSpecs}}.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment