Module: Resque

Extended by:
Resque
Included in:
Resque
Defined in:
lib/resque/resque.rb,
lib/resque/throttle.rb,
lib/resque/throttled_job.rb

Defined Under Namespace

Classes: SettingNotFound, ThrottledError, ThrottledJob

Instance Method Summary collapse

Instance Method Details

#enqueue_with_throttle(klass, *args) ⇒ Object Also known as: enqueue



9
10
11
12
13
14
15
16
17
18
19
20
# File 'lib/resque/resque.rb', line 9

def enqueue_with_throttle(klass, *args)
  if should_throttle?(klass, *args)
    unless klass.throttle_settings[:silent]
      raise(
        ThrottledError,
        "#{klass} with key #{klass.key(*args)} has exceeded it's throttle limit"
      )
    end
  else
    enqueue_without_throttle(klass, *args)
  end
end