我有两台服务器,我从一台服务器(A)复制代码,然后尝试在另一台服务器上运行(B)。
我在A的所有工人都工作正常。当我从B运行工作人员时,我收到了这个错误:
NameError: uninitialized constant FeedRefresherFetcher
这里是引发错误的工作人员代码:
class FeedRefresherScheduler
include Sidekiq::Worker
def perform
Feed.select(:id, :feed_url).find_in_batches(batch_size: 5000) do |feeds|
arguments = feeds.map do |feed|
values = feed.attributes.values
values
end
Sidekiq::Client.push_bulk(
'args' => arguments,
'class' => 'FeedRefresherFetcher',
'queue' => 'feed_refresher_fetcher',
'retry' => false
)
end
end
end
完整的错误跟踪:
2014-09-01T12:41:19Z 14958 TID-qien4 WARN: uninitialized constant FeedRefresherFetcher
2014-09-01T12:41:19Z 14958 TID-qien4 WARN: /usr/local/rvm/gems/ruby-2.0.0-p481/gems/activesupport-4.0.2/lib/active_support/inflector/methods.rb:226:in `const_get'
/usr/local/rvm/gems/ruby-2.0.0-p481/gems/activesupport-4.0.2/lib/active_support/inflector/methods.rb:226:in `block in constantize'
/usr/local/rvm/gems/ruby-2.0.0-p481/gems/activesupport-4.0.2/lib/active_support/inflector/methods.rb:224:in `each'
/usr/local/rvm/gems/ruby-2.0.0-p481/gems/activesupport-4.0.2/lib/active_support/inflector/methods.rb:224:in `inject'
/usr/local/rvm/gems/ruby-2.0.0-p481/gems/activesupport-4.0.2/lib/active_support/inflector/methods.rb:224:in `constantize'
/usr/local/rvm/gems/ruby-2.0.0-p481/gems/activesupport-4.0.2/lib/active_support/core_ext/string/inflections.rb:66:in `constantize'
/usr/local/rvm/gems/ruby-2.0.0-p481/gems/sidekiq-2.17.1/lib/sidekiq/processor.rb:43:in `block in process'
/usr/local/rvm/gems/ruby-2.0.0-p481/gems/sidekiq-2.17.1/lib/sidekiq/processor.rb:86:in `do_defer'
/usr/local/rvm/gems/ruby-2.0.0-p481/gems/sidekiq-2.17.1/lib/sidekiq/processor.rb:37:in `process'
/usr/local/rvm/gems/ruby-2.0.0-p481/gems/celluloid-0.15.2/lib/celluloid/calls.rb:25:in `public_send'
/usr/local/rvm/gems/ruby-2.0.0-p481/gems/celluloid-0.15.2/lib/celluloid/calls.rb:25:in `dispatch'
/usr/local/rvm/gems/ruby-2.0.0-p481/gems/celluloid-0.15.2/lib/celluloid/calls.rb:122:in `dispatch'
/usr/local/rvm/gems/ruby-2.0.0-p481/gems/celluloid-0.15.2/lib/celluloid/actor.rb:322:in `block in handle_message'
/usr/local/rvm/gems/ruby-2.0.0-p481/gems/celluloid-0.15.2/lib/celluloid/actor.rb:416:in `block in task'
/usr/local/rvm/gems/ruby-2.0.0-p481/gems/celluloid-0.15.2/lib/celluloid/tasks.rb:55:in `block in initialize'
/usr/local/rvm/gems/ruby-2.0.0-p481/gems/celluloid-0.15.2/lib/celluloid/tasks/task_fiber.rb:13:in `block in create'
另请注意,我的workers目录中没有定义名为FeedRefresherFetcher的工作程序。但是,代码再次与服务器A相同,而在服务器A上则相同。
我对sidekiq工人不太了解。知道什么可能是错的吗?