resque / resque-web

a Rails-based web interface to Resque
235 stars 166 forks source link

Failures show page does not work with multiple failed queues #98

Open omarqureshi opened 8 years ago

omarqureshi commented 8 years ago

Trying to get multiple failed queues to show up on resque-web 0.0.7, i'm using a fork of resque at 1.25.2 with https://github.com/resque/resque/pull/1234 applied to it as the multiple queue failure backend was not functional

In doing so and trying to go to /failures/:id I get the following error:

Showing /mnt/resque-web/app/views/resque_web/failures/show.html.erb where line #3 raised:

undefined method `any?' for nil:NilClass
Extracted source (around line #3):

1. <h1>Failed Jobs <%= "on '#{params[:id]}'" if params[:id] %> <%= "with class '#{params[:class]}'" if params[:class] %></h1>
2.
3. <% if @jobs.any? %>
4.  <%= form_tag("/failures/#{params[:id] if params[:id]}", :method => :delete) do %>
5.    <%= submit_tag "Clear #{params[:id] ? "'#{params[:id]}'" : 'Failed'} Jobs", :confirm => "Are you sure?", :class => 'btn btn-danger' %>
6.  <% end %>

Rails.root: /mnt/resque-web-container

The underlying stack trace looks pretty unhelpful, however, the error makes sense as @jobs is not defined anywhere other than in the workers helper.

What's interesting is that going to /failures?queue=:queue somewhat works, in that extracts the right failed jobs for the right failed queue however the counts are wrong.

I'll be putting together a pull request which emulates the behaviour of the index view with working pagination if that's ok, unless you have a better solution for me to working towards?

omarqureshi commented 8 years ago

So, upon looking at the test suite I've realised that actual the failures controller is a bit confused whether the resource that is actually acting upon is a failed job rather than a failed queue (thus the destroy_all / retry member methods which totally make sense for jobs, but, the show method doesn't make sense for queues)

I'll have a think about which routes design-wise makes sense for displaying the failed jobs/queues

omarqureshi commented 8 years ago

I've put together https://github.com/talis/resque-web/pull/1 which fixes this (and uses the current 0.0.7 tagging commit as a point of where to start), however, I'm not comfortable submitting this until the multiqueue backend for resque is fixed, is there a good way of getting them to merge one of the pull requests to fix that in?

mlohbihler commented 3 years ago

@omarqureshi , did you ever get to a solution with this issue? I'm having the same problem, but with different versions. My resque is 1.27.4, resque-web is 0.0.12.

pn-y commented 3 years ago

Any updates?