Skip to content

Commit

Permalink
Use sort_by{rand} instead of sort{rand} for randomization as sort{ran…
Browse files Browse the repository at this point in the history
…d} is of consistent outcome. Thanks Alex Ostleitner.
  • Loading branch information
tobi committed Dec 30, 2008
1 parent a99302b commit 9935082
Showing 1 changed file with 1 addition and 2 deletions.
3 changes: 1 addition & 2 deletions lib/delayed/job.rb
@@ -1,4 +1,3 @@

module Delayed

class DeserializationError < StandardError
Expand Down Expand Up @@ -113,7 +112,7 @@ def self.find_available(limit = 5, max_run_time = MAX_RUN_TIME)
find(:all, :conditions => conditions, :order => NextTaskOrder, :limit => limit)
end

records.sort { rand() }
records.sort_by { rand() }
end

# Get the payload of the next job we can get an exclusive lock on.
Expand Down

0 comments on commit 9935082

Please sign in to comment.