Skip to content

Commit

Permalink
Use the default restart intensity in all supervisors
Browse files Browse the repository at this point in the history
This reduces from 10 restarts in 10 seconds to 1 restart
in 5 seconds. This is the new default in OTP 18, and it
fits the kinds of processes that Ranch deals with:

* Supervisors: default makes sense.

* Acceptors: they crash on socket error. They'll probably
  crash again if the socket didn't change.

* Connection processes: they are never restarted.
  • Loading branch information
essen committed Dec 18, 2015
1 parent cfb5386 commit ae8ff1f
Show file tree
Hide file tree
Showing 3 changed files with 3 additions and 3 deletions.
2 changes: 1 addition & 1 deletion src/ranch_acceptors_sup.erl
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,7 @@ init([Ref, NbAcceptors, Transport, TransOpts]) ->
LSocket, Transport, ConnsSup
]}, permanent, brutal_kill, worker, []}
|| N <- lists:seq(1, NbAcceptors)],
{ok, {{one_for_one, 10, 10}, Procs}}.
{ok, {{one_for_one, 1, 5}, Procs}}.

-spec listen_error(any(), module(), any(), atom()) -> no_return().
listen_error(Ref, Transport, TransOpts2, Reason) ->
Expand Down
2 changes: 1 addition & 1 deletion src/ranch_listener_sup.erl
Original file line number Diff line number Diff line change
Expand Up @@ -39,4 +39,4 @@ init({Ref, NbAcceptors, Transport, TransOpts, Protocol}) ->
[Ref, NbAcceptors, Transport, TransOpts]},
permanent, infinity, supervisor, [ranch_acceptors_sup]}
],
{ok, {{rest_for_one, 10, 10}, ChildSpecs}}.
{ok, {{rest_for_one, 1, 5}, ChildSpecs}}.
2 changes: 1 addition & 1 deletion src/ranch_sup.erl
Original file line number Diff line number Diff line change
Expand Up @@ -29,4 +29,4 @@ init([]) ->
{ranch_server, {ranch_server, start_link, []},
permanent, 5000, worker, [ranch_server]}
],
{ok, {{one_for_one, 10, 10}, Procs}}.
{ok, {{one_for_one, 1, 5}, Procs}}.

0 comments on commit ae8ff1f

Please sign in to comment.