Simple_one_for_one start_child () returns already_started

I have a supervisor who should start simple_one_for_one workers. When I call start_child() for the first time, everything goes fine. But, when I do this a second time, I get {error,{already_started,<0.71.0>}} . Why will the head of simple_one_for_one return me already_started ? What am I missing?

Here is the code: supervisor , worker .

+7
source share
1 answer

you register a (local) name for your gen_server. after you start it, you cannot start another with the same name.

if you use gen_server: start_link / 3 instead, removing the first argument from your current gen_server: start_link / 4 call, you can start more than one.

+15
source

All Articles