[erlang-questions] Stopping a master process and all its workers

YD Jiang jan4984@REDACTED
Thu Apr 12 17:04:32 CEST 2018


yes just exit the top supervisor. any cleanup can be done in {:EXIT ...}
message, or handle_info({:EXIT ...} if a gen_server.

On Thu, Apr 12, 2018 at 10:47 PM Torben Hoffmann <torben.lehoff@REDACTED>
wrote:

> Hi,
>
> I am a bit in doubt about what would be the cleanest way to stop a part of
> my supervision tree.
>
> The tree looks like this:
> top_sup
>   ├─ master
>   └─ worker_sup
>        └─ worker
>
> I have multiple instances of the top_sup supervisor, one for each master.
> So when I need to stop a master and all its workers I would have to stop
> its top_sup and everything below it.
>
> Controlled stopping needs to be different from a crash as a controlled
> stop should remove some persistent data for the master and workers.
>
> Should I just do an exit(top_sup, normal) for the controlled stop?
> Or should I implement a stop function all the way down?
> Are there any subtleties that I need to cater for? Have I given enough
> information for this question to make sense?
>
> Either will do the job. Just wondering what experience others have on this.
>
> Cheers,
> Torben
>
> --
> https://www.linkedin.com/in/torbenhoffmann/
> _______________________________________________
> 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/20180412/15b7256f/attachment.htm>


More information about the erlang-questions mailing list