We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
1 parent df245b2 commit 796175fCopy full SHA for 796175f
app/models/concerns/rate_limitable.rb
@@ -12,8 +12,8 @@ def initialize(duration: nil)
12
class_methods do
13
def rate_limit(key = name, to:, within:)
14
around_perform do |job, block|
15
- unless Lock.acquire(key, limit: to, duration: within) { block }
16
- raise Limit.new(duration:)
+ unless Lock.acquire(key, limit: to, duration: within) { block.call }
+ raise Limit.new(duration: within)
17
end
18
19
0 commit comments