Skip to content

Fixing Issue with _id not having sub-second resolution / jobs not sorted by insertion order #3

Open
wants to merge 2 commits into from

2 participants

@tilo
tilo commented Apr 7, 2013

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, so a job can be queued with it's origin timestamp
and/or can be put back into the queue with the original timestamp if it failed

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}

@tilo
tilo commented Apr 23, 2013

this change is against the unreleased Moped version on head

@dbackeus
dbackeus commented Jul 9, 2013

Won't merge this as we're ok with the possibility of fuzzy ordering of jobs at Streamio and we'd like to keep the code base simple.

You might want to add tests so that other people who need the feature would be more comfortable with using your fork though.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Something went wrong with that request. Please try again.