Skip to content

Commit

Permalink
Don't crash if unparseable values exist on the failure queue.
Browse files Browse the repository at this point in the history
We saw some jobs become unloadable on our resque queue, due to issues turning strangely-encoded strings into JSON and back. This meant that resque couldn't parse the jobs, and so we were seeing `nil` elements in the `failures` array.

This is the simplest way of preventing these malformed entries from preventing monitoring of the failures queue entirely.
  • Loading branch information
lazyatom authored and defunkt committed Mar 17, 2011
1 parent 2327083 commit 5e89916
Showing 1 changed file with 5 additions and 0 deletions.
5 changes: 5 additions & 0 deletions lib/resque/server/views/failed.erb
Expand Up @@ -16,6 +16,10 @@
<% index += 1 %>
<li>
<dl>
<% if job.nil? %>
<dt>Error</dt>
<dd>Job <%= index%> could not be parsed; perhaps it contains invalid JSON?</dd>
<% else %>
<dt>Worker</dt>
<dd>
<a href="<%= url(:workers, job['worker']) %>"><%= job['worker'].split(':')[0...2].join(':') %></a> on <b class='queue-tag'><%= job['queue'] %></b > at <b><span class="time"><%= job['failed_at'] %></span></b>
Expand Down Expand Up @@ -47,6 +51,7 @@
<%=h job['error'] %>
<% end %>
</dd>
<% end %>
</dl>
<div class='r'>
</div>
Expand Down

0 comments on commit 5e89916

Please sign in to comment.