summaryrefslogtreecommitdiff
path: root/src/catlfish_sup.erl
diff options
context:
space:
mode:
Diffstat (limited to 'src/catlfish_sup.erl')
-rw-r--r--src/catlfish_sup.erl13
1 files changed, 12 insertions, 1 deletions
diff --git a/src/catlfish_sup.erl b/src/catlfish_sup.erl
index 5da7b93..353b691 100644
--- a/src/catlfish_sup.erl
+++ b/src/catlfish_sup.erl
@@ -9,6 +9,16 @@
start_link(_Args) ->
supervisor:start_link({local, ?MODULE}, ?MODULE, []).
+permanent_worker(Name, {Module, Function, Args}) ->
+ permanent_worker(Name, {Module, Function, Args}, [Module]).
+
+permanent_worker(Name, StartFunc, Modules) ->
+ {Name,
+ StartFunc,
+ permanent,
+ 10000,
+ worker, Modules}.
+
gen_http_config(Config, SSLOptions, SSLFlag) ->
{ChildName, IpAddress, Port, Module} = Config,
{ok, IPv4Address} =
@@ -37,6 +47,7 @@ init([]) ->
gen_http_config(Config, SSLOptions, false)
end, application:get_env(catlfish, http_servers, [])),
lager:debug("Starting servers ~p", [Servers]),
+ RateLimit = permanent_worker(ratelimit, {ratelimit, start_link, []}),
{ok,
{{one_for_one, 3, 10},
- Servers}}.
+ [RateLimit | Servers]}}.