Navigation Menu

Skip to content
This repository has been archived by the owner on May 27, 2021. It is now read-only.

Commit

Permalink
Jobs without payload are ignored
Browse files Browse the repository at this point in the history
It's probably some weird edge case problem caused by resque backends dieing  unexpectedly. I'm unsure.
All I know is that this fixed the problem on our server: it allowed me to list & restart failed jobs which were otherwise inaccessible due to code of this type raising an error:

  job["payload"]["class"] # => raise no method [] for nil

So there were blank jobs or jobs without payload. Pre-selecting fixes the immediate problem.
  • Loading branch information
Narnach committed Sep 8, 2011
1 parent b2ce95c commit f3d8a48
Showing 1 changed file with 4 additions and 1 deletion.
5 changes: 4 additions & 1 deletion lib/resque_cleaner.rb
Expand Up @@ -226,7 +226,10 @@ def all(index=0,count=1)
jobs = @cleaner.failure.all( index, count)
jobs = [] unless jobs
jobs = [jobs] unless jobs.is_a?(Array)
jobs.each{|j| j.extend FailedJobEx}
jobs = jobs.select do |job|
job.extend FailedJobEx
job && job["payload"]
end
jobs
end

Expand Down

0 comments on commit f3d8a48

Please sign in to comment.