summaryrefslogtreecommitdiff
path: root/src/catlfish_sup.erl
diff options
context:
space:
mode:
authorMagnus Ahltorp <map@kth.se>2015-06-11 16:38:30 +0200
committerMagnus Ahltorp <map@kth.se>2015-06-11 16:38:30 +0200
commite109e12abb56414cbf64aad7a7e38c19062cdbb9 (patch)
treeb3c59a3f363f4be1ed0224751c4f8dee3850614e /src/catlfish_sup.erl
parent1d4ee3918c353649f2a166f0bdd6a1846caccfee (diff)
Implement rate limiting of add_chainratelimit
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..3defec6 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} =
@@ -39,4 +49,5 @@ init([]) ->
lager:debug("Starting servers ~p", [Servers]),
{ok,
{{one_for_one, 3, 10},
- Servers}}.
+ [permanent_worker(ratelimit, {ratelimit, start_link, []}) |
+ Servers]}}.