Permalink
Browse files

* DM performance improvements

  • Loading branch information...
1 parent e9b1573 commit 93833cce48edd0495f61fc851d4f85866d8253cf @lpetre lpetre committed Apr 7, 2010
Showing with 3 additions and 2 deletions.
  1. +3 −2 lib/delayed/backend/data_mapper.rb
@@ -30,9 +30,9 @@ class Job
property :id, Serial
property :priority, Integer, :default => 0, :index => :run_at_priority
property :attempts, Integer, :default => 0
- property :handler, Text
+ property :handler, Text, :lazy => false
property :run_at, Time, :index => :run_at_priority
- property :locked_at, Time
+ property :locked_at, Time, :index => true
property :locked_by, String
property :failed_at, Time
property :last_error, Text
@@ -69,6 +69,7 @@ def self.clear_locks!(worker_name)
# Lock this job for this worker.
# Returns true if we have the lock, false otherwise.
def lock_exclusively!(max_run_time, worker = worker_name)
+
now = self.class.db_time_now
overtime = now - max_run_time

0 comments on commit 93833cc

Please sign in to comment.