Skip to content

Commit d690c48

Browse files
authored
Fix lexical errors in GenServer docs (#13858)
1 parent 2a25d4e commit d690c48

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

lib/elixir/pages/mix-and-otp/genservers.md

+2-2
Original file line numberDiff line numberDiff line change
@@ -41,7 +41,7 @@ Please read the `GenServer` module documentation for an overview if you haven't
4141

4242
## GenServer callbacks
4343

44-
A GenServer is a process that invokes a limited set of functions under specific conditions. When we used a `Agent`, we would keep both the client code and the server code side by side, like this:
44+
A GenServer is a process that invokes a limited set of functions under specific conditions. When we used an `Agent`, we would keep both the client code and the server code side by side, like this:
4545

4646
```elixir
4747
def put(bucket, key, value) do
@@ -258,7 +258,7 @@ iex> flush()
258258

259259
Note `Process.monitor(pid)` returns a unique reference that allows us to match upcoming messages to that monitoring reference. After we stop the agent, we can `flush/0` all messages and notice a `:DOWN` message arrived, with the exact reference returned by `monitor`, notifying that the bucket process exited with reason `:normal`.
260260

261-
Let's reimplement the server callbacks to fix the bug and make the test pass. First, we will modify the GenServer state to two dictionaries: one that contains `name -> pid` and another that holds `ref -> name`. Then we need to monitor the buckets on `handle_cast/2` as well as implement a `handle_info/2` callback to handle the monitoring messages. The full server callbacks implementation is shown below:
261+
Let's reimplement the server callbacks to fix the bug and make the test pass. First, we will modify the GenServer state to two maps: one that contains `name -> pid` and another that holds `ref -> name`. Then we need to monitor the buckets on `handle_cast/2` as well as implement a `handle_info/2` callback to handle the monitoring messages. The full server callbacks implementation is shown below:
262262

263263
```elixir
264264
## Server callbacks

0 commit comments

Comments
 (0)