Ghoul.summon/2 raises one of the undead to stalk your process, waiting until just after death to consume the corpse… err… execute a custom callback.
Ghoul.reap_in/3 invites the carrion eaters to slay a misbehaving process after a timeout, unless
reap_in is called again to set a new timeout, or
banish prevent the Ghoul from mincing up his tasty treat.
I’ve been using this in production for a few months, and it has elegantly solved some tricky issues; my current favorite is delaying a supervisor’s restart of a worker, but only when the worker exited while in a particular situation.
Check out the rest of the API over at the repo
Read next Filtrex 0.4.1 Released