Module: Resque::Lifecycle::ClassMethods

Defined in:
lib/resque/lifecycle.rb

Instance Method Summary collapse

Instance Method Details

#push(queue, item) ⇒ Object

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



15
16
17
18
19
20
21
# 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