Class: Resque::Failure::Redis

Inherits:
Base
  • Object
show all
Defined in:
lib/resque-priority-jobs/failure/redis.rb

Class Method Summary collapse

Class Method Details

.requeue_with_priority(index) ⇒ Object



4
5
6
7
8
9
10
11
12
13
# File 'lib/resque-priority-jobs/failure/redis.rb', line 4

def self.requeue_with_priority(index)
  item = all(index)
  item['retried_at'] = Time.now.strftime("%Y/%m/%d %H:%M:%S")
  Resque.redis.lset(:failed, index, Resque.encode(item))
  if item['payload']['priority']
    Job.create_with_priority(item['queue'], item['payload']['class'], item['payload']['priority'], *item['payload']['args'])
  else
    Job.create(item['queue'], item['payload']['class'], *item['payload']['args'])
  end
end