Automatically restart dynamically added supervisor children

According to the Erlang / OTP manual, if I add a child to the dispatcher using supervisor:start_child, and the dispatcher works, the child will not restart automatically.

( http://www.erlang.org/doc/design_principles/sup_princ.html#id73986 )

Is there an easy way around the problem, or do I need to manually save the dynamically added children and manage the reboot myself? (My supervisor has the overseer above, so this is possible, although not very elegant.)

+3
source share
1 answer

- , , , ( trap_exit). , , , - poof!

, ( - ). , , . , , , , - , - ( ), .

, , , , . , , , " , , " , - ( , , - ).

:

- , " ". , Erlang (, , , ..) . - , : , , ..?

, : . , "" .. ( , ). ( ) .

: " ?" . , , supervisor:start_child/2 supervisor:delete_child/2 simple_one_for_one ?

. , , , , , - , - , . , , , , , , . - , , , , , .

, ? - , . , , . , , _, (, , POOF! , , ). , db .

, . , , , , , . , , , - (, , - ), , , . , , . , (, waste_of_youth:tempt_souls(Node, Port, Cert)), supervisor:start_child/2 - .

, , ? POOF! , ( , , , , , , ), . , , . , - , , , . , - , , , , .

, . , , " ", ( , ). " ", , , . - . - , , - .

+4

Source: https://habr.com/ru/post/1623066/


All Articles