Chapter 17. Who Supervises the Supervisors?
Supervisors are one of the most useful parts of OTP. We’ve encountered basic supervisors in Chapter 12 and Chapter 13, where they offered a way to keep our software going in case of errors by just restarting the faulty processes. This chapter introduces OTP’s take on supervisors, which is much better than ours.
In our earlier examples, our supervisors would start a worker process, link to it, and trap exit signals with process_flag(trap_exit,true)
to know when the process died and restart it. This is fine when we want restarts, but it’s also pretty dumb. Imagine that you’re using the remote control to turn on the TV. If it doesn’t work the first time, you might try again once or twice, just in case you ...
Get Learn You Some Erlang for Great Good! now with the O’Reilly learning platform.
O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.