class Resque::Job

Public Instance Methods

fail(exception)
Also aliased as: fail_without_throttler
Alias for: fail_with_throttler
fail_with_throttler(exception) click to toggle source

This is added for when there is a dirty exit TODO: testme

# File lib/resque/throttler.rb, line 95
def fail_with_throttler(exception)
  if @throttled
    redis.hmset("throttler:jobs:#{@throttler_uuid}", "ended_at", Time.now.to_i)
  end
  fail_without_throttler(exception)
end
Also aliased as: fail
fail_without_throttler(exception)
Alias for: fail
initialize(queue, payload)
Also aliased as: initialize_without_throttler
initialize_with_throttler(queue, payload) click to toggle source
# File lib/resque/throttler.rb, line 68
def initialize_with_throttler(queue, payload)
  @throttled = Resque.queue_rate_limited?(queue)
  @throttler_uuid = SecureRandom.uuid
  initialize_without_throttler(queue, payload)
end
Also aliased as: initialize
initialize_without_throttler(queue, payload)
Alias for: initialize
perform()
Also aliased as: perform_without_throttler
perform_with_throttler() click to toggle source
# File lib/resque/throttler.rb, line 76
def perform_with_throttler
  if @throttled
    begin
      # TODO this needs to be wrapped in a transcation
      redis.hmset("throttler:jobs:#{@throttler_uuid}", "started_at", Time.now.to_i)
      redis.sadd("throttler:#{queue}_uuids", @throttler_uuid)
      perform_without_throttler
    ensure
      redis.hmset("throttler:jobs:#{@throttler_uuid}", "ended_at", Time.now.to_i)
    end
  else
    perform_without_throttler
  end
end
Also aliased as: perform
perform_without_throttler()
Alias for: perform