Worker Restart Options

So far we’ve looked at supervision from the point of view of the supervisor. In particular, we’ve seen how the supervision strategy tells the supervisor how to deal with the death of a child process.

There’s a second level of configuration that applies to individual workers. The most commonly used of these is the :restart option.

Previously we said that a supervisor strategy (such as :one_for_all) is invoked when a worker dies. That’s not strictly true. Instead, the strategy is invoked when a worker needs restarting. And the conditions when a worker should be restarted are dictated by its restart: option:

:permanent

This worker should always be running—it is permanent. This means that the supervision strategy will be applied ...

Get Programming Elixir ≥ 1.6 now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.