@@ -165,7 +165,8 @@ defmodule Supervisor do
165165 means that, if the child process exits due to a `:normal`, `:shutdown`
166166 or `{:shutdown, term}` reason, it won't be restarted. This is useful
167167 as it allows our workers to politely shutdown and be removed from the
168- simple one for one supervisor, without being restarted
168+ simple one for one supervisor, without being restarted. You can find
169+ more information about restart strategies on `Supervisor.Spec`
169170
170171 With the supervisor defined, let's dynamically start stacks:
171172
@@ -180,6 +181,26 @@ defmodule Supervisor do
180181 Supervisor.count_children(sup_pid)
181182 #=> %{active: 2, specs: 1, supervisors: 0, workers: 2}
182183
184+ ## Exit reasons
185+
186+ From the example above, you may have noticed that the transient restart
187+ strategy for the worker does not restart the child in case it crashes with
188+ reason `:normal`, `:shutdown` or `{:shutdown, term}`.
189+
190+ So one may ask: which exit reason should I choose when existing my worker?
191+ There are three options:
192+
193+ * `:normal` - on such cases, the exit won't be logged, there is no restart
194+ on transient mode and linked processes are not broken
195+
196+ * `:shutdown` or `{:shutdown, term}` - on such cases, the exit won't be
197+ logged, there is no restart on transient mode and linked processes are
198+ broken (with the same exit reason)
199+
200+ * any other term - on such cases, the exit will be logged, there are
201+ restarts on transient mode and linked processes are broken (with the
202+ same exit reason)
203+
183204 ## Name Registration
184205
185206 A supervisor is bound to the same name registration rules as a `GenServer`.
0 commit comments