diff options
author | Siri Hansen <[email protected]> | 2014-06-30 11:27:46 +0200 |
---|---|---|
committer | Siri Hansen <[email protected]> | 2014-10-20 17:06:22 +0200 |
commit | 1d4379e307cd7256e019e962b0ece6a1badcffb9 (patch) | |
tree | ea8606c7fce452266ac318994c3111ecd0ecc239 /lib/stdlib/src/win32reg.erl | |
parent | a7289521bcb7494f33e86360b096844c5b6bc68d (diff) | |
download | otp-1d4379e307cd7256e019e962b0ece6a1badcffb9.tar.gz otp-1d4379e307cd7256e019e962b0ece6a1badcffb9.tar.bz2 otp-1d4379e307cd7256e019e962b0ece6a1badcffb9.zip |
Allow maps for supervisor flags and child specs
Earlier, supervisor flags and child specs were given as tuples. While
this is kept for backwards compatibility, it is now also allowed to
give these parameters as maps:
-type sup_flags() :: #{strategy => strategy(), % optional
intensity => non_neg_integer(), % optional
period => pos_integer()} % optional
-type child_spec() :: #{id => child_id(), % mandatory
start => mfargs(), % mandatory
restart => restart(), % optional
shutdown => shutdown(), % optional
type => worker(), % optional
modules => modules()} % optional
Default values are as follows:
Supervisor flags:
strategy: one_for_one
intensity: 1
period: 5
Child specs:
restart: permanent
type: worker
shutdown: 5000 for workers, 'infinity' for supervisors
modules: [M], where M comes from the child's start {M,F,A}
Some of these default values are quite hard to decide on, since there
really is no "most common way". It always depends on the use case. So
we decided that the most important reason for having default values is
to lower the start barrier and get "something" running. For production
use, most systems must be fine tuned in this respect anyway.
This is how we reasoned about it:
Strategy: just pick one - and 'one_for_one' was most used in OTP.
Max restart frequency (intensity/period): by allowing one restart only
we keep the important supervisor feature of restarting children, but
we also avoid the possibility of scaling to a huge amount of restarts
if the supervisor tree is deep.
Restart: just pick one - and 'permanent' is fairly common.
Shutdown for workers: to avoid the confusion of why the terminate
function is not executed, we decided not to use 'brutal_kill'. Which
number to use is probably not that important, so we chose 5000.
Shutdown for supervisors: the recommended shutdown value for
supervisors is 'infinity', so we decied to use that. Having the same
(integer) value as for workers can give very strange results.
Type: just pick one - and we believe that 'worker' is most common
Diffstat (limited to 'lib/stdlib/src/win32reg.erl')
0 files changed, 0 insertions, 0 deletions