[erlang-questions] supervisor with priorities?

Sean Cribbs seancribbs@REDACTED
Sat Jul 4 17:44:04 CEST 2015


Rodrigo,

It sounds like you need two levels of supervision:

S1 supervises D and S2, with a "rest_for_one" strategy, with D first. When
D dies, this kills S2 and all of its supervised processes.

S2 supervises A, B, and C with a "one_for_one" strategy. When any one of
them dies, they restart independently. However, since they are under S2,
they ALL get restarted when S2 restarts as a consequence of D restarting.

Hope that helps!

On Sat, Jul 4, 2015 at 9:29 AM, Rodrigo Dominguez <mails@REDACTED>
wrote:

> I have four gen_servers, and I would like to do a special supervision.
>
> gen_servers A, B, and C, they all depends on gen_server D.
>
> If gen_server A goes down, I want to restart it without affecting the
> others.
> If gen_server B goes down, I want to restart it without affecting the
> others.
> If gen_server C goes down, I want to restart it without affecting the
> others.
>
> If gen_server D goes down, I want kill and restart all of the gen_servers.
>
> Any hint now how to structure the supervisor tree or how to make it work
> with OTP? I usually use supervisors with one_for_one and one_for_all but
> I’m clueless on how to archive the desired behavior.
>
> Rodrigo Dominguez
> mails@REDACTED
>
> _______________________________________________
> erlang-questions mailing list
> erlang-questions@REDACTED
> http://erlang.org/mailman/listinfo/erlang-questions
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://erlang.org/pipermail/erlang-questions/attachments/20150704/7f7f0cc3/attachment.htm>


More information about the erlang-questions mailing list