From 16762abdcffa53834d44e22eb4d26ef699c89fc2 Mon Sep 17 00:00:00 2001 From: "j.uhlig" Date: Tue, 8 May 2018 10:16:34 +0200 Subject: Add configurable restart intensity for ranch_sup --- src/ranch_sup.erl | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) 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}}. -- cgit v1.2.3