Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse files

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

…er avoid locking issues
  • Loading branch information...
commit d0a9c2d5044746445ec7beebf3f0ca62ea12c525 1 parent 916e9f2
@tobi authored
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)
Please sign in to comment.
Something went wrong with that request. Please try again.