Skip to content

Instantly share code, notes, and snippets.

@elbrujohalcon
Created October 29, 2016 04:15
Show Gist options
  • Save elbrujohalcon/03a5c75d9d2f3075cd56cad0b0079a2d to your computer and use it in GitHub Desktop.
Save elbrujohalcon/03a5c75d9d2f3075cd56cad0b0079a2d to your computer and use it in GitHub Desktop.
-module(animals_sup).
-behaviour(supervisor).
-export([start_link/1, init/1]).
start_link(Name) -> supervisor:start_link({local, Name}, ?MODULE, Name).
init(Name) ->
SupFlags = #{ strategy => simple_one_for_one
, intensity => 5 % restarts in ...
, period => 1 % second
},
ChildSpecs = [#{ id => animal
, start => {animal, start_link, [Name]}
, restart => permanent
}
],
{ok, {SupFlags, ChildSpecs}}.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment