Skip to content

Instantly share code, notes, and snippets.

@ray-sh
Created July 23, 2017 08:40
Show Gist options
  • Save ray-sh/025a7fec9343e62e3ff16aa3a48f5ed4 to your computer and use it in GitHub Desktop.
Save ray-sh/025a7fec9343e62e3ff16aa3a48f5ed4 to your computer and use it in GitHub Desktop.
How module the world with elixir
1. How to distiguish the same object?
We use tuple which consist of type and ID
def init({db_folder, pool_size}) do
processes = for worker_id <- 1..pool_size do
worker(
Todo.DatabaseWorker, [db_folder, worker_id],
id: {:database_worker, worker_id}
)
end
supervise(processes, strategy: :one_for_one)
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment