streamio/mongo-resque — pull request #3 by tilo (2013-04-07 20:46:38+00:00)
Title: Fixing Issue with _id not having sub-second resolution / jobs not sorted by insertion order

fixing three things in lib/resque.rb

1) pop() sorts now by :resque_enqueue_timestamp, instead of _id
2) list_range() and therefore peek() sort by :resque_enqueue_timestamp

3) push sets the resque_enqueue_timestamp only if it was not handed-in via item,
allowing the user to override the :resque_enqueue_timestamp

item[:resque_enqueue_timestamp] ||= Time.now # instead of =

TODO: the code should create/ensure an index for each queue:
{resque_enqueue_timestamp: 1} , {background: true}