diff options
author | j.uhlig <[email protected]> | 2018-05-08 10:16:34 +0200 |
---|---|---|
committer | Loïc Hoguin <[email protected]> | 2018-05-16 17:05:00 +0200 |
commit | 16762abdcffa53834d44e22eb4d26ef699c89fc2 (patch) | |
tree | 7dd3c9862174a9ebcedb18782fdac33e96831c2e | |
parent | 301f582b97f82e7f7dc2d41bb575671bcc30215e (diff) | |
download | ranch-16762abdcffa53834d44e22eb4d26ef699c89fc2.tar.gz ranch-16762abdcffa53834d44e22eb4d26ef699c89fc2.tar.bz2 ranch-16762abdcffa53834d44e22eb4d26ef699c89fc2.zip |
Add configurable restart intensity for ranch_sup
-rw-r--r-- | src/ranch_sup.erl | 10 |
1 files changed, 9 insertions, 1 deletions
diff --git a/src/ranch_sup.erl b/src/ranch_sup.erl index f5bf82e..3cb0cd6 100644 --- a/src/ranch_sup.erl +++ b/src/ranch_sup.erl @@ -23,10 +23,18 @@ start_link() -> supervisor:start_link({local, ?MODULE}, ?MODULE, []). init([]) -> + Intensity = case application:get_env(ranch_sup_intensity) of + {ok, Value1} -> Value1; + undefined -> 1 + end, + Period = case application:get_env(ranch_sup_period) of + {ok, Value2} -> Value2; + undefined -> 5 + end, ranch_server = ets:new(ranch_server, [ ordered_set, public, named_table]), Procs = [ {ranch_server, {ranch_server, start_link, []}, permanent, 5000, worker, [ranch_server]} ], - {ok, {{one_for_one, 1, 5}, Procs}}. + {ok, {{one_for_one, Intensity, Period}, Procs}}. |