Skip to content

Instantly share code, notes, and snippets.

@coline-carle
Created September 16, 2017 20:44
Show Gist options
  • Save coline-carle/2c46488f61a9bf4ca8cc319af2aae030 to your computer and use it in GitHub Desktop.
Save coline-carle/2c46488f61a9bf4ca8cc319af2aae030 to your computer and use it in GitHub Desktop.
defmodule ArmoryCrawler.CharacterSupervisor do
use Supervisor
def start_link(_) do
{:ok, supervisor} = Supervisor.start_link(__MODULE__, [], name: __MODULE__)
case ArmoryCrawler.env() do
:prod ->
Supervisor.start_child(__MODULE__, ["eu"])
Supervisor.start_child(__MODULE__, ["us"])
Supervisor.start_child(__MODULE__, ["kr"])
Supervisor.start_child(__MODULE__, ["tw"])
_ ->
Supervisor.start_child(__MODULE__, ["eu"])
end
{:ok, supervisor}
end
def init(_arg) do
Supervisor.init([{ArmoryCrawler.Character, :dynamic}], strategy: :simple_one_for_one)
end
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment