I've tried using Resque before and was met with unmitigated failure. I'm revisiting it again with the same results...
resque.rake:
require "resque/tasks"
task "resque:setup" => :environment
test.rb:
require 'resque'
class FileWorker
@queue = :save_to_file
def self.perform(str)
File.open('./' + Time.now.to_s + '.txt', 'w+') do |f|
f << "test 123"
end
end
end
Resque.enqueue(FileWorker, "12345567".split('').shuffle.join)
Gemfile:
gem 'resque'
gem 'rake'
It seems like running test.rb on its own successfully queues the job:

However, running rake resque:work QUEUE='*' in the same folder results in a warning,
WARNING: This way of doing signal handling is now deprecated. Please see http://hone.heroku.com/resque/2012/08/21/resque-signals.html for more info.
As well as the task being added to "failed" queue with the following reason: "exception":"NameError","error":"uninitialized constant FileWorker"
How do I get this to work? Seems like something quite obvious but there's tons of tutorials about Resque spanning many years - some painfully out of date and none explaining how to run workers so they don't fail.
Thanks in advance.
SomeWorkin any of the code you posted - post the real code. - simonwoSomeWorkor not (in the rakefile), it still seems that it's missing when push comes to shove with resque - dsp_099Resque.enqueuecommand only in your test.rb file? You need to [also] have it in your controller, or wherever else you want to initiate the worker. Oh, and the warning is not relevant to the problem... not that it doesn't matter but alleviating the warning won't solve your problem, and ignoring it won't prevent your problem from being solved. - pgblu