You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: lib/elixir/pages/mix-and-otp/dynamic-supervisor.md
+7-7Lines changed: 7 additions & 7 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -12,9 +12,9 @@ We have successfully learned how our supervision tree is automatically started (
12
12
Supervisors know how to start processes because they are given "child specifications". In our `lib/kv.ex` file, we defined a list of children with a single child spec:
13
13
14
14
```elixir
15
-
children = [
16
-
{Registry, name:KV, keys::unique}
17
-
]
15
+
children = [
16
+
{Registry, name:KV, keys::unique}
17
+
]
18
18
```
19
19
20
20
When the child specification is a tuple (as above) or module, then it is equivalent to calling the `child_spec/1` function on said module, which then returns the full specification. The pair above is equivalent to:
@@ -71,10 +71,10 @@ Given our buckets can already be supervised, it is time to hook them into our su
71
71
Given our buckets can already be supervised, you may be thinking to start them as part of our application `start/2` callback, such as:
And while the above would definitely work, it comes with a huge caveat: it only starts a single bucket. In practice, we want the user to be able to create new buckets at any time. In other words, we need to start and supervise processes dynamically.
0 commit comments