gpt4 book ai didi

ruby - sidekiq+whenever+unicorn uninitialized constant ClassWorker 生产环境

转载 作者:数据小太阳 更新时间:2023-10-29 07:18:32 28 4
gpt4 key购买 nike

我使用 Rails 4,sidekiq 2.13.1,cron 脚本每 2 分钟运行一次。第一次执行期间没有错误,但接下来的所有错误。我只在生产环境中遇到这个错误。我的 worker 位于 app/workers 中。我在 application.rb 中通过以下字符串将其包含在内:

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

错误:

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'

对此有什么想法吗?谢谢。

最佳答案

通过将此行添加到 production.rb 配置文件并将我的工作人员和依赖类移动到 lib 文件夹来解决它。这是配置:

config.eager_load = true
config.eager_load_paths += %W(#{config.root}/lib)
config.autoload_paths += %W(#{config.root}/lib)

关于ruby - sidekiq+whenever+unicorn uninitialized constant ClassWorker 生产环境,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/18252952/

28 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com