@@ -287,16 +287,16 @@ defmodule GenStage do
287
287
concurrency in a GenStage pipeline, especially if events can be processed out
288
288
of order.
289
289
290
- Also note that we set the supervision strategy to `:rest_for_one`. This
291
- is important because if the producer A terminates, all of the other
292
- processes will terminate too, since they are consuming events produced
293
- by A . In this scenario, the supervisor will see multiple processes shutting
294
- down at the same time, and conclude there are too many failures in a short
295
- interval. However, if the strategy is `:rest_for_one`, the supervisor will
296
- shut down the rest of tree, and already expect the remaining process to fail.
297
- One downside of `:rest_for_one` though is that if a `C` process dies, any other
298
- `C` process after it will die too. You can solve this by putting them under
299
- their own supervisor.
290
+ Also note that we set the supervision strategy to `:rest_for_one`. This is
291
+ important. Consider an alternative case where `:one_for_one` is used. If the
292
+ producer `A` terminates, all of the other processes will terminate too, since
293
+ they are consuming events produced by `A` . In this scenario, the supervisor will
294
+ see multiple processes shutting down at the same time, and conclude there are
295
+ too many failures in a short interval. However, if the strategy is
296
+ `:rest_for_one`, the supervisor will shut down the rest of tree, and already
297
+ expect the remaining processes to fail. One downside of `:rest_for_one` though
298
+ is that if a `C` process dies, any other `C` process after it will die too.
299
+ You can solve this by putting them under their own supervisor if desired .
300
300
301
301
Another alternative to the scenario above is to use a `ConsumerSupervisor`
302
302
for consuming the events instead of N consumers. The `ConsumerSupervisor`
0 commit comments