Skip to content

Commit 76bd16a

Browse files
brettcannonmichalmuskala
authored andcommitted
Drop a wayward period (elixir-lang#1205)
1 parent a825cfb commit 76bd16a

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

getting-started/mix-otp/dynamic-supervisor.markdown

+1-1
Original file line numberDiff line numberDiff line change
@@ -128,7 +128,7 @@ One flaw that shows up right away is the ordering issue. Since `KV.Registry` inv
128128

129129
The second flaw is related to the supervision strategy. If `KV.Registry` dies, all information linking `KV.Bucket` names to bucket processes is lost. Therefore the `KV.BucketSupervisor` and all children must terminate too - otherwise we will have orphan processes.
130130

131-
In light of this observation, we should consider moving to another supervision strategy. The two other candidates are `:one_for_all` and `:rest_for_one`. A supervisor using the `:rest_for_one` will kill and restart child processes which were started *after* the crashed child. In this case, we would want `KV.BucketSupervisor` to terminate if `KV.Registry` terminates. This would require the bucket supervisor to be placed after the registry. Which violates the ordering constraints we have established two paragraphs above.
131+
In light of this observation, we should consider moving to another supervision strategy. The two other candidates are `:one_for_all` and `:rest_for_one`. A supervisor using the `:rest_for_one` will kill and restart child processes which were started *after* the crashed child. In this case, we would want `KV.BucketSupervisor` to terminate if `KV.Registry` terminates. This would require the bucket supervisor to be placed after the registry which violates the ordering constraints we have established two paragraphs above.
132132

133133
So our last option is to go all in and pick the `:one_for_all` strategy: the supervisor will kill and restart all of its children processes whenever any one of them dies. This is a completely reasonable approach for our application, since the registry can't work without the bucket supervisor, and the bucket supervisor should terminate without the registry. Let's reimplement `init/1` in `KV.Supervisor` to encode those properties:
134134

0 commit comments

Comments
 (0)