Sha256: 8ca7834f00ba3b82e92079d3fde8da29dfff0d7617996bdf4dee72a72932d0c7
Contents?: true
Size: 715 Bytes
Versions: 3
Compression:
Stored size: 715 Bytes
Contents
# frozen_string_literal: true module Prop class RateLimited < StandardError attr_accessor :handle, :cache_key, :retry_after, :description, :first_throttled, :threshold 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 self.threshold = options.fetch(:threshold) super(options.fetch(:strategy).threshold_reached(options)) end def config Prop.configurations.fetch(@handle) end end end
Version data entries
3 entries across 3 versions & 1 rubygems
Version | Path |
---|---|
prop-2.9.0 | lib/prop/rate_limited.rb |
prop-2.8.0 | lib/prop/rate_limited.rb |
prop-2.7.0 | lib/prop/rate_limited.rb |