Skip to content

RateLimit::Result

Mohamed Motaweh edited this page Oct 4, 2022 · 1 revision

The result object has the following attributes

attribute/method Description
topic The given topic to the RateLimit.throttle(topic: ...) method
value The given value to the RateLimit.throttle(value: ...) method
threshold The threshold of the exceeded limit (Defaults to null)
interval The interval of the exceeded limit (Defaults to null)
success? A boolean for the success/failure states of the throttling

Example

  result = RateLimit.throttle(topic: :send_sms, value: id)
  result.topic     # 'send_sms'
  result.value     # id
  result.threshold # 2
  result.interval  # 60
  result.success?  # false
Clone this wiki locally