Skip to content
Browse files

Fix for typo, also return jobs in random order to yield site to furth…

…er avoid locking issues
  • Loading branch information...
1 parent 916e9f2 commit d0a9c2d5044746445ec7beebf3f0ca62ea12c525 @tobi tobi committed
Showing with 4 additions and 2 deletions.
  1. +3 −1 lib/delayed/job.rb
  2. +1 −1 lib/delayed/worker.rb
View
4 lib/delayed/job.rb
@@ -104,9 +104,11 @@ def self.find_available(limit = 5, max_run_time = MAX_RUN_TIME)
conditions.unshift(sql)
- ActiveRecord::Base.silence do
+ records = ActiveRecord::Base.silence do
find(:all, :conditions => conditions, :order => NextTaskOrder, :limit => limit)
end
+
+ records.sort { rand() }
end
# Get the payload of the next job we can get an exclusive lock on.
View
2 lib/delayed/worker.rb
@@ -36,7 +36,7 @@ def start
end
ensure
- Delayed::Job..clear_locks!
+ Delayed::Job.clear_locks!
end
def say(text)

0 comments on commit d0a9c2d

Please sign in to comment.
Something went wrong with that request. Please try again.