Search⌘ K
AI Features

Putting the Proctor to Work

Explore how to schedule timed quizzes and manage worker processes in Elixir using OTP. Understand handling active sessions, timeout events, and strategies for recovering from server crashes to build resilient distributed applications.

Scheduling a quiz

First, let’s schedule a quiz:

Executable

C++
alias Mastery.Examples.Math
C++
alias Mastery.Boundary.QuizSession
C++
alias Mastery.Examples.Math
C++
alias Mastery.Boundary.QuizSession
C++
one_minute_from_now = DateTime.add(now, 60)
C++
now = DateTime.utc_now()

Note: Since the quiz is timed, it might end before you can enter the rest of the commands below. In that case, you’ll have to restart the iex terminal and re-enter all of the “Executable” commands shown above.

Output

iex(1)> alias Mastery.Examples.Math
Mastery.Examples.Math
iex(2)> alias Mastery.Boundary.QuizSession
Mastery.Boundary.QuizSession
iex(3)> alias Mastery.Examples.Math
Mastery.Examples.Math
iex(4
...