module Resque::Lifecycle::ClassMethods

Public Instance Methods

push(queue, item) click to toggle source

Wrapper for the original Resque push method, which adds a created_at timestamp to any item pushed onto the queue which responds to []=.

# File lib/resque/lifecycle.rb, line 15
def push(queue, item)
  if item.respond_to?(:[]=)
    exists = item.respond_to?(:[]) && item['created_at']
    item['created_at'] = Time.now.to_i unless exists
  end
  push_without_lifecycle queue, item
end