How to identify if a process is being spawned or restarted?

You can monitor death of a process, and turn a restart flag on, before the init of the restarted process.

By the way You should use handle_continue to make initialization, instead of init, if it takes some time.

There is a good example of pool in the little book of Elixir/OTP

3 Likes