What happens if you supervise a supervisor as a worker?

In this section of the docs, it mentions that you can specify a type in the child spec for either worker or supervisor. As the question in the title implies, what would be the consequences of picking the wrong one?

4 Likes

Looking at the Erlang code:

It appears that the process type is used to define the default “Shutdown Value” if none is given (see “Shutdown Values” in https://hexdocs.pm/elixir/Supervisor.html)

It also appears that the type is used when you call Supervior.count_children which tells you how many of which type of child a supervisor has.

The type is also returned by Supervisor.which_children

4 Likes

It also affects code upgrading.

4 Likes