Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Supervisor restart backoff #1287

Closed
wants to merge 5 commits into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
16 changes: 15 additions & 1 deletion lib/stdlib/doc/src/supervisor.xml
Original file line number Diff line number Diff line change
Expand Up @@ -77,7 +77,9 @@
<pre>
sup_flags() = #{strategy => strategy(), % optional
intensity => non_neg_integer(), % optional
period => pos_integer()} % optional</pre>
period => pos_integer(), % optional
min_delay => pos_integer(), % optional
max_delay => pos_integer()} % optional</pre>

<p>A supervisor can have one of the following <em>restart strategies</em>
specified with the <c>strategy</c> key in the above map:</p>
Expand Down Expand Up @@ -138,6 +140,18 @@ sup_flags() = #{strategy => strategy(), % optional
<c>intensity</c> defaults to <c>1</c> and <c>period</c> defaults to
<c>5</c>.</p>

<p>In order not to use up all restart attempts in a very short time
before the error condition has had time to clear, a supervisor can
delay repeated restarts by exponential backoff, starting at
<c>min_delay</c> milliseconds and limited at <c>max_delay</c>
milliseconds. The delay happens asynchronously and does not block the
supervisor. By default, <c>min_delay</c> is 1 millisecond and
<c>max_delay</c> is 500 milliseconds. (In practice, in simple
situations like when the OS is still holding on to a socket, or the
Erlang process registry has not yet unregistered a name, only one or
two delayed restart attempts will typically be needed.) To disable
delayed restarts completely, set <c>max_delay</c> to zero.</p>

<marker id="child_spec"/>
<p>The type definition of a child specification is as follows:</p>

Expand Down
Loading