QueueClassic/queue_classic

rake qc:count is broken

Paxa opened this issue · 3 comments

Paxa commented
% rake qc:count               
rake aborted!
NoMethodError: undefined method `queue' for #<QC::Worker:0x007ffce39bb300>
/Users/pavel/.rvm/gems/ruby-2.1.2/gems/queue_classic-3.0.0/lib/queue_classic/tasks.rb:32:in `block (2 levels) in <top (required)>'
/Users/pavel/.rvm/gems/ruby-2.1.2/bin/ruby_executable_hooks:15:in `eval'
/Users/pavel/.rvm/gems/ruby-2.1.2/bin/ruby_executable_hooks:15:in `<main>'

This is my working solution

Rake::Task["qc:count"].clear

namespace :qc do
  desc "Returns the number of jobs in the (default or QUEUE) queue"
  task :count => :environment do
    QC::Worker.new.queues.each do |queue|
      puts "#{queue.name} ->\t #{queue.count}"
    end
  end
end
Paxa commented

Wow, fast 👍

@Paxa I tried to keep the tasks behavior close to it's description. That's why I did not print the result from the Workers queues. I do think we need to reevaluate the goal behind that task though.

Thank you for reporting 💛

/cc @jipiboily

Awesome, thanks for the fix @senny. I'll release a new gem version soon-ish with that and another bug fix.