File tree Expand file tree Collapse file tree
lib/phoenix_container_example Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -11,7 +11,7 @@ defmodule PhoenixContainerExample.Autoscaling do
1111 require Logger
1212
1313 @ tab :aws_autoscaling
14- @ default_duration to_timeout ( minute: 5 )
14+ @ default_backoff_duration to_timeout ( minute: 5 )
1515
1616 # Public API
1717
@@ -85,9 +85,10 @@ defmodule PhoenixContainerExample.Autoscaling do
8585 @ spec rate_limit ( map ( ) , keyword ( ) ) :: { :ok , map ( ) } | { :error , :rate_limit }
8686 defp rate_limit ( event , opts ) do
8787 rate_limit = opts [ :rate_limit ] || RateLimit
88+ backoff_duration = opts [ :backoff_duration ] || @ default_backoff_duration
8889
8990 resource_id = Map . fetch! ( event , :resource_id )
90- { duration , event } = Map . pop ( event , :backoff_duration , @ default_duration )
91+ { duration , event } = Map . pop ( event , :backoff_duration , backoff_duration )
9192
9293 case rate_limit . hit ( resource_id , duration , 1 ) do
9394 { :allow , _count } ->
@@ -165,7 +166,8 @@ defmodule PhoenixContainerExample.Autoscaling do
165166
166167 defaults = [
167168 tab: @ tab ,
168- rate_limit: RateLimit
169+ rate_limit: RateLimit ,
170+ backoff_duration: @ default_backoff_duration
169171 ]
170172
171173 opts = Keyword . merge ( defaults , args )
You can’t perform that action at this time.
0 commit comments