elixir - Perform actions in supervisor when worker exits -


is there way perform actions in supervisor after worker exits (in addition restarting worker).

at moment have code inside worker (below) seems run half time.

try     some_work()  catch :exit, reason    save_reason_to_db()    exit(reason) 

the worker has one_for_one stragtegy, 1 worker running. every time worker exits supervisor start new one.

it seems every second time worker exits, runs save_reason_to_db(), , every other time doesn't.

i'm not otp expert simplest solution set second process in supervisor monitor failing process , work (like saving reason db or issue notification).

this way concerns nicely separated between application structure (supervisors) , reacting process lifetime events.


Comments

Popular posts from this blog

javascript - jQuery: Add class depending on URL in the best way -

caching - How to check if a url path exists in the service worker cache -

Redirect to a HTTPS version using .htaccess -