Method: Istox::RateLimit#exec_within_threshold
- Defined in:
- lib/istox/helpers/rate_limit.rb
#exec_within_threshold(subject, options = {}) { ... } ⇒ Object
Execute a block once the rate limit is within bounds WARNING This will block the current thread until the rate limit is within bounds.
130 131 132 133 134 135 |
# File 'lib/istox/helpers/rate_limit.rb', line 130 def exec_within_threshold(subject, = {}) [:threshold] ||= 30 [:interval] ||= 30 sleep @bucket_interval while exceeded?(subject, ) yield(self) end |