Created
December 13, 2011 18:45
-
-
Save bradical/1473303 to your computer and use it in GitHub Desktop.
DelayedJob ActiveRecord Queries
This file contains 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
# Output failed jobs by id with the delayed job type, associated ActiveRecord type, id, and method if applicable | |
Delayed::Job.where("failed_at is not null").select("id, handler, run_at, failed_at, last_error, job_type").order("id ASC").each { |j| puts "Id: #{j.id}\n DJ Type: #{$1 if j.handler =~ /!ruby\/struct:Delayed::(\w*) \n/}\n Failed at: #{j.failed_at}\n Object type: #{$1 if j.handler =~ /\nobject: !ruby\/(.*?)\s*\n/}\n Object Id: #{$1.to_i if j.handler =~ / id: (\d*)\n/}\n Method Name: #{$1 if j.handler =~ /\nmethod_name: (.*)\n/}\n Size: #{j.handler.size}\n\n\n"} | |
# Failed jobs | |
Delayed::Job.where('failed_at is not null') |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment