resque-throttle 0.2.12 → 0.2.13
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- data/VERSION +1 -1
- data/lib/resque/resque.rb +5 -5
- data/lib/resque/throttled_job.rb +1 -1
- data/resque-throttle.gemspec +1 -1
- metadata +1 -1
data/VERSION
CHANGED
@@ -1 +1 @@
|
|
1
|
-
0.2.
|
1
|
+
0.2.13
|
data/lib/resque/resque.rb
CHANGED
@@ -7,10 +7,10 @@ module Resque
|
|
7
7
|
class ThrottledError < RuntimeError; end
|
8
8
|
|
9
9
|
def enqueue_with_throttle(klass, *args)
|
10
|
-
if should_throttle?(klass, args)
|
10
|
+
if should_throttle?(klass, *args)
|
11
11
|
raise ThrottledError.new("#{klass} with key #{klass.key} has exceeded it's throttle limit")
|
12
12
|
end
|
13
|
-
enqueue_without_throttle(klass, args)
|
13
|
+
enqueue_without_throttle(klass, *args)
|
14
14
|
end
|
15
15
|
alias_method :enqueue_without_throttle, :enqueue
|
16
16
|
alias_method :enqueue, :enqueue_with_throttle
|
@@ -19,13 +19,13 @@ module Resque
|
|
19
19
|
|
20
20
|
def should_throttle?(klass, *args)
|
21
21
|
return false if !throttle_job?(klass) || klass.disabled
|
22
|
-
return true if key_found?(klass, args)
|
23
|
-
redis.set(klass.key(args), true, klass.can_run_every)
|
22
|
+
return true if key_found?(klass, *args)
|
23
|
+
redis.set(klass.key(*args), true, klass.can_run_every)
|
24
24
|
return false
|
25
25
|
end
|
26
26
|
|
27
27
|
def key_found?(klass, *args)
|
28
|
-
redis.get(klass.key(args))
|
28
|
+
redis.get(klass.key(*args))
|
29
29
|
end
|
30
30
|
|
31
31
|
def throttle_job?(klass)
|
data/lib/resque/throttled_job.rb
CHANGED
data/resque-throttle.gemspec
CHANGED