Laying Grounds for the Proctor Boundary Server
Let’s write some functions to handle our quizzes in our proctor.
We'll cover the following...
We'll cover the following...
Building the reply
Let’s talk about the reply:
-
It needs to set the state of the
GenServerand set a timeout, so we’ll get control back for starting the next quiz. -
In this code, we’re going to make use of a little-used
GenServerfeature, appending an optional timeout to a:replytuple. -
When we’re done, our
:replytuple should look like{:reply, :ok, quizzes, timeout}.
The timeout is optional, so we’ll leave it off if the quizzes are empty.
Our code, then, returns any quizzes that have not yet been started and tacks on a timeout so that we’ll get control back in time to start the next quiz.
With the broad strokes coded, let’s see how we go about building that reply tuple. We’ll fill this in ...