Skip to content

Commit 5e89916

Browse files
lazyatomdefunkt
authored andcommitted
Don't crash if unparseable values exist on the failure queue.
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.
1 parent 2327083 commit 5e89916

File tree

1 file changed

+5
-0
lines changed

1 file changed

+5
-0
lines changed

lib/resque/server/views/failed.erb

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,10 @@
1616
<% index += 1 %>
1717
<li>
1818
<dl>
19+
<% if job.nil? %>
20+
<dt>Error</dt>
21+
<dd>Job <%= index%> could not be parsed; perhaps it contains invalid JSON?</dd>
22+
<% else %>
1923
<dt>Worker</dt>
2024
<dd>
2125
<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>
@@ -47,6 +51,7 @@
4751
<%=h job['error'] %>
4852
<% end %>
4953
</dd>
54+
<% end %>
5055
</dl>
5156
<div class='r'>
5257
</div>

0 commit comments

Comments
 (0)