Skip to content

Commit

Permalink
args args args
Browse files Browse the repository at this point in the history
  • Loading branch information
scotttam committed Feb 26, 2010
1 parent 5d0c7d0 commit 6c20922
Show file tree
Hide file tree
Showing 3 changed files with 7 additions and 7 deletions.
10 changes: 5 additions & 5 deletions lib/resque/resque.rb
Expand Up @@ -7,10 +7,10 @@ module Resque
class ThrottledError < RuntimeError; end

def enqueue_with_throttle(klass, *args)
if should_throttle?(klass, args)
if should_throttle?(klass, *args)
raise ThrottledError.new("#{klass} with key #{klass.key} has exceeded it's throttle limit")
end
enqueue_without_throttle(klass, args)
enqueue_without_throttle(klass, *args)
end
alias_method :enqueue_without_throttle, :enqueue
alias_method :enqueue, :enqueue_with_throttle
Expand All @@ -19,13 +19,13 @@ def enqueue_with_throttle(klass, *args)

def should_throttle?(klass, *args)
return false if !throttle_job?(klass) || klass.disabled
return true if key_found?(klass, args)
redis.set(klass.key(args), true, klass.can_run_every)
return true if key_found?(klass, *args)
redis.set(klass.key(*args), true, klass.can_run_every)
return false
end

def key_found?(klass, *args)
redis.get(klass.key(args))
redis.get(klass.key(*args))
end

def throttle_job?(klass)
Expand Down
2 changes: 1 addition & 1 deletion lib/resque/throttled_job.rb
Expand Up @@ -20,7 +20,7 @@ def self.identifier(*args)
end

def self.key(*args)
[self.to_s, identifier(args)].compact.join(":")
[self.to_s, identifier(*args)].compact.join(":")
end

def self.can_run_every
Expand Down
2 changes: 1 addition & 1 deletion resque-throttle.gemspec
Expand Up @@ -5,7 +5,7 @@

Gem::Specification.new do |s|
s.name = %q{resque-throttle}
s.version = "0.2.12"
s.version = "0.2.13"

s.required_rubygems_version = Gem::Requirement.new(">= 0") if s.respond_to? :required_rubygems_version=
s.authors = ["Scott J. Tamosunas"]
Expand Down

0 comments on commit 6c20922

Please sign in to comment.