I am wondering how you would structure a simple kitchen timer. For example, you set a timer for 15 minutes and need to count down to zero. When it reaches zero, you print “DONE” to the terminal.
The solution I have uses a GenServer to start the timer and then
Process.send_after(self(), :times_up, 900000) which works in a happy path situation.
My question is how do you make this same thing resilient to a crash or a restart? If you restart back at 15 minutes, you burn the food. Would you have to lean on a database? What would you store so you don’t skip a beat when the timer recovers?