Skip to content

Commit

Permalink
Remove a few other traces of Rails 2
Browse files Browse the repository at this point in the history
  • Loading branch information
bkeepers committed Sep 6, 2010
1 parent f91dda3 commit 7232cf1
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 13 deletions.
15 changes: 4 additions & 11 deletions lib/delayed/backend/active_record.rb
Expand Up @@ -25,17 +25,10 @@ class Job < ::ActiveRecord::Base

before_save :set_default_run_at

if ::ActiveRecord::VERSION::MAJOR >= 3
scope :ready_to_run, lambda {|worker_name, max_run_time|
where(['(run_at <= ? AND (locked_at IS NULL OR locked_at < ?) OR locked_by = ?) AND failed_at IS NULL', db_time_now, db_time_now - max_run_time, worker_name])
}
scope :by_priority, order('priority ASC, run_at ASC')
else
named_scope :ready_to_run, lambda {|worker_name, max_run_time|
{:conditions => ['(run_at <= ? AND (locked_at IS NULL OR locked_at < ?) OR locked_by = ?) AND failed_at IS NULL', db_time_now, db_time_now - max_run_time, worker_name]}
}
named_scope :by_priority, :order => 'priority ASC, run_at ASC'
end
scope :ready_to_run, lambda {|worker_name, max_run_time|
where(['(run_at <= ? AND (locked_at IS NULL OR locked_at < ?) OR locked_by = ?) AND failed_at IS NULL', db_time_now, db_time_now - max_run_time, worker_name])
}
scope :by_priority, order('priority ASC, run_at ASC')

def self.after_fork
::ActiveRecord::Base.connection.reconnect!
Expand Down
2 changes: 0 additions & 2 deletions spec/spec_helper.rb
Expand Up @@ -5,8 +5,6 @@
require 'spec'
require 'logger'

gem 'activerecord', ENV['RAILS_VERSION'] if ENV['RAILS_VERSION']

require 'delayed_job'
require 'delayed/backend/shared_spec'

Expand Down

0 comments on commit 7232cf1

Please sign in to comment.