Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

sidekiq+whenever+unicorn uninitialized constant ClassWorker production env

I use Rails 4, sidekiq 2.13.1, whenever, cron script run every 2 minutes. No errors during the first execute but all next get errors. I got this error only in production env. My worker locate in app/workers. I've included it by following string in application.rb:

config.eager_load_paths += %W(#{config.root}/app/workers) 

Error:

2013-08-15T12:34:05Z 31102 TID-oh1d0 WARN: {"retry"=>true, "queue"=>"default", "class"=>"AllGlobalWorker", "args"=>[], "jid"=>"c8f5827813277c890b4a621e", "enqueued_at"=>1376570045.3903732}
2013-08-15T12:34:05Z 31102 TID-oh1d0 WARN: uninitialized constant AllGlobalWorker
2013-08-15T12:34:05Z 31102 TID-oh1d0 /home/shared/bundle/ruby/2.0.0/gems/activesupport-4.0.0/lib/active_support/inflector/methods.rb:226:in `const_get'

Any ideas for this? Thanks.

like image 605
BuDen Avatar asked Nov 02 '22 16:11

BuDen


1 Answers

Solved it by adding this lines to production.rb config file and move my workers and dependency classes to lib folder. This is config:

config.eager_load = true
config.eager_load_paths += %W(#{config.root}/lib)
config.autoload_paths += %W(#{config.root}/lib)
like image 111
BuDen Avatar answered Nov 07 '22 21:11

BuDen