patch lab 03 from feedback

This commit is contained in:
SowinskiBraeden committed 2026-10-01 18:11:51 -07:00
1 parent 7f5f47042a
commit d05bb4b089
4 files changed
+30 -8

No files matched your search

+3 -1
View File
@@ -13,6 +13,8 @@ defmodule Arithmetic.Worker do
@impl true
def handle_cast({:square, x, from}, state) do
# The server dispatches work asynchronously, so workers handle casts and
# reply directly to the client that made the original GenServer.call/2.
GenServer.reply(from, {self(), x * x})
{:noreply, state}
end
@@ -61,7 +63,7 @@ defmodule Arithmetic.Server do
GenServer.cast(worker, {:square, x, from})
next = rem(index + 1, length(workers))
# dont reply here, worker will reply
# Do not reply here; the selected worker replies to `from` after the cast.
{:noreply, {workers, next}}
end