ruby on rails - Heroku resque/clockwork 'No job defined for class' -


trying run background job on heroku using resque/clockwork.

locally, jobs queued clockwork , executed resque expected. on heroku, sometimes works... of time clockwork queues job expected, , when executed resque failed job error 'no job defined class'.

exact error shows through resque admin panel is:

worker 960f8a1b-cce9-497a-a7ab-9b40c166a600:2+1 on featured_catalog_items_cache @ 27 minutes ago     retry or remove class nil arguments nil exception error error no job defined class 'workers::featuredcatalogitemscacheworker' 

code looks like:

/app/models/workers/featured_catalog_items_cache_worker.rb

class workers::featuredcatalogitemscacheworker    @queue = :featured_catalog_items_cache    def self.perform     p 'do work' # there more code here edited brevity   end end 

/lib/clock.rb

require file.expand_path('../../config/boot',        __file__) require file.expand_path('../../config/environment', __file__) require 'clockwork'  module clockwork   every(2.minutes, 'queueing featuredcatalogitemscacheworker job') { resque.enqueue(workers::featuredcatalogitemscacheworker) } end 

/lib/tasks/resque.rake

require 'resque/tasks'  task "resque:setup" => :environment env['queue'] = '*' end 

procfile

web: rackup -p $port resque: env term_child=1 bundle exec rake resque:work clock: bundle exec clockwork lib/clock.rb 

missing something?

maybe in /lib/clock.rb

require 'workers::featuredcatalogitemscacheworker' 

solution :

require './config/boot' require './config/environment' require 'clockwork' require 'resque'

module clockwork

handler |job| puts "running job : #{job}" resque.enqueue(job) end

every(15.minutes, newsrssreader ) end


Comments

Popular posts from this blog

apache - Remove .php and add trailing slash in url using htaccess not loading css -

javascript - jQuery show full size image on click -