[erlang-patches] allow use of proplists in supervisor start specs
Henrik Nord
henrik@REDACTED
Wed Jan 4 16:17:53 CET 2012
Hi
I would like to include this patch, however it must be completed with
documentation and tests.
Thank you for the contribution!
On 01/03/2012 10:11 PM, Richard Carlsson wrote:
> The formats of the supervisor flags (the 3-tuple {one_for_one,
> Restarts, Time}) and the child specifications (6-tuples {name, etc.,
> etc.}) are annoyingly hard both to read and write. This patch makes it
> possible to pass lists of options instead, and sets useful defaults
> for most fields. This also opens for the possibility to add more flags
> both to supervisors and children in the future.
>
> git fetch git://github.com/richcarl/otp.git proplist-child-spec
>
> For example:
>
> init()
> SupFlags = [{period,10}],
> Child = [{name, foo}, {start, {M,F,A}}]
> {ok, {SupFlags, [Child]}}.
>
> This gets you a one-for-one supervisor with a particular restart time
> period, and a single child with default behaviour. The name and start
> options are required.
>
> The supervisor flag defaults are:
>
> strategy = one_for_one
> intensity = 10
> period = 30
>
> I.e., one-for-one supervision and at most 10 restarts in the last 30
> seconds. This restart frequency seems like a useful default; let me
> know if you think some other numbers would be significantly better.
>
> The child spec defaults are:
> restart_type = permanent
> shutdown = 2000
> child_type = worker
> modules = [M], where M is the module in the start MFA
>
> Finally, there is a new function supervisor:get_childspec(Sup, Child)
> which can be used to get the full child specification (as a list)
> needed to restart the same child or another child like it.
>
> Note that the documentation has not been updated as part of this patch.
>
> /Richard
> _______________________________________________
> erlang-patches mailing list
> erlang-patches@REDACTED
> http://erlang.org/mailman/listinfo/erlang-patches
--
/Henrik Nord Erlang/OTP
More information about the erlang-patches
mailing list