Created
July 23, 2017 08:40
-
-
Save ray-sh/025a7fec9343e62e3ff16aa3a48f5ed4 to your computer and use it in GitHub Desktop.
How module the world with elixir
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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