Adding a Proctor to Run Timed Quizzes
Explore how to build a proctor module to run timed quizzes using GenServer in Elixir. Learn to schedule quizzes, manage quiz lifecycle, and control quiz availability for students, enhancing your concurrency and process management skills within OTP.
Scheduling quizzes
To be useful in a classroom setting, Mastery should be able to schedule quizzes. Here’s the step by step flow for the major actors working with Mastery:
-
A teacher schedules a quiz.
-
At the quiz’s scheduled starting time, the proctor makes that quiz available in the quiz manager.
-
A student takes a quiz.
-
At the scheduled end time, the proctor automatically stops all student processes for that quiz and removes the quiz from the manager.
This is exactly the kind of machinery that defines the worker layer. It’s not lifecycle code because it lives outside of the configured lifecycle policies in our GenServers. It goes beyond simple boundary code because it will stop GenServer ...