Created
February 5, 2011 10:50
-
-
Save mcollina/812364 to your computer and use it in GitHub Desktop.
A migration to improve Delayed Job performance when runned with Delayed::Worker.destroy_failed_jobs = false.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
class ImproveDelayedJobsIndex < ActiveRecord::Migration | |
def self.up | |
remove_index :delayed_jobs, :name => "delayed_jobs_priority" | |
add_index :delayed_jobs, [:failed_at, :priority, :run_at], :name => 'delayed_jobs_priority' | |
end | |
def self.down | |
remove_index :delayed_jobs, :name => "delayed_jobs_priority" | |
add_index :delayed_jobs, [:priority, :run_at], :name => 'delayed_jobs_priority' | |
end | |
end |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment