Is there a way to perform actions in the supervisor after a worker exits (in addition to just restarting the worker).
At the moment I have some code inside the worker (below) that seems to run about half the time.
try do
some_work()
catch :exit, reason
save_reason_to_db()
exit(reason)
The worker has a one_for_one stragtegy, only one worker running. So every time the worker exits the supervisor will start a new one.
It seems like every second time this worker exits, it runs the save_reason_to_db(), and every other time it doesn't.