Sha256: 59a3306d0a12e3c009c02b8a3c49fb14ce26814925689c1181b2893d2d09e9c7
Contents?: true
Size: 623 Bytes
Versions: 2
Compression:
Stored size: 623 Bytes
Contents
module Prop class RateLimited < StandardError attr_accessor :handle, :cache_key, :retry_after, :description, :first_throttled def initialize(options) self.handle = options.fetch(:handle) self.cache_key = options.fetch(:cache_key) self.first_throttled = options.fetch(:first_throttled) self.description = options[:description] interval = options.fetch(:interval).to_i self.retry_after = interval - Time.now.to_i % interval super(options.fetch(:strategy).threshold_reached(options)) end def config Prop.configurations.fetch(@handle) end end end
Version data entries
2 entries across 2 versions & 1 rubygems
Version | Path |
---|---|
prop-2.1.1 | lib/prop/rate_limited.rb |
prop-2.1.0 | lib/prop/rate_limited.rb |