diff --git a/lib/delayed/job.rb b/lib/delayed/job.rb index f826efcc0..b05100e51 100644 --- a/lib/delayed/job.rb +++ b/lib/delayed/job.rb @@ -1,4 +1,3 @@ - module Delayed class DeserializationError < StandardError @@ -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.