简体   繁体   English

Rails / Sidekiq在无法识别的模块中工作失败

[英]Rails/Sidekiq failing on job in unrecognized module

As you can see in the stack trace below, Reminders::FindStaleJobsJob is causing a problem because of the uninitialized constant Reminders . 正如您在下面的堆栈跟踪中所看到的,由于未初始化的常量RemindersReminders::FindStaleJobsJob引起了问题。 What I don't get is that I don't call Reminders::FindStaleJobsJob anywhere; 我没有得到的是,我没有在任何地方调用Reminders::FindStaleJobsJob rather, I call Recaps::FindStaleJobsJob . 相反,我叫Recaps::FindStaleJobsJob

I have flushed out the Sidekiq queue and still get this error repeatedly. 我已经刷新了Sidekiq队列,但仍然反复收到此错误。

2018-09-25T17:45:14.539Z 12784 TID-oxxicof3s INFO: Running in ruby 2.4.1p111 (2017-03-22 revision 58053) [x86_64-darwin17]
2018-09-25T17:45:14.539Z 12784 TID-oxxicof3s INFO: See LICENSE and the LGPL-3.0 for licensing details.
2018-09-25T17:45:14.539Z 12784 TID-oxxicof3s INFO: Upgrade to Sidekiq Pro for more features and support: http://sidekiq.org
2018-09-25T17:45:14.541Z 12784 TID-oxxicof3s INFO: Starting processing, hit Ctrl-C to stop
2018-09-25T18:00:05.107Z 12784 TID-oxxi975os Recaps::FindStaleJobsJob JID-ec113586e3f8fe72eb3ca479 INFO: start
2018-09-25T18:00:05.135Z 12784 TID-oxxim1crg ActiveJob::QueueAdapters::SidekiqAdapter::JobWrapper JID-4bc5f87567ca3f019b2015e4 INFO: start
2018-09-25T18:00:05.136Z 12784 TID-oxxi970ss Recaps::FindStaleJobsJob JID-3125783fd5da7604b95bb813 INFO: start
2018-09-25T18:00:05.155Z 12784 TID-oxxim1crg ActiveJob::QueueAdapters::SidekiqAdapter::JobWrapper JID-4bc5f87567ca3f019b2015e4 INFO: fail: 0.02 sec
2018-09-25T18:00:05.155Z 12784 TID-oxxim1crg WARN: {"context":"Job raised exception","job":{"class":"ActiveJob::QueueAdapters::SidekiqAdapter::JobWrapper","queue":"default","description":"","args":[{"job_class":"Reminders::FindStaleJobsJob","job_id":"d6161fcf-2abd-4e2b-8946-73668a78282f","queue_name":"default","arguments":[]}],"retry":true,"jid":"4bc5f87567ca3f019b2015e4","created_at":1537898405.1336598,"enqueued_at":1537898405.133705},"jobstr":"{\"class\":\"ActiveJob::QueueAdapters::SidekiqAdapter::JobWrapper\",\"queue\":\"default\",\"description\":\"\",\"args\":[{\"job_class\":\"Reminders::FindStaleJobsJob\",\"job_id\":\"d6161fcf-2abd-4e2b-8946-73668a78282f\",\"queue_name\":\"default\",\"arguments\":[]}],\"retry\":true,\"jid\":\"4bc5f87567ca3f019b2015e4\",\"created_at\":1537898405.1336598,\"enqueued_at\":1537898405.133705}"}
2018-09-25T18:00:05.155Z 12784 TID-oxxim1crg WARN: NameError: uninitialized constant Reminders

My Sidekiq cron initializer: 我的Sidekiq cron初始化程序:

#/config/initializers/sidekiq_cron_scheduler.rb
jobs_hash = {
  'recap' => {
    'class' => 'Recaps::FindStaleJobsJob',
    'cron' => '0, 15, 30, 45 * * * *',
    'active_job' => true
  }
}

Sidekiq::Cron::Job.load_from_hash jobs_hash

Am I doing something silly and obvious? 我在做些愚蠢而明显的事情吗?

Something was hung up somewhere. 某处挂了东西。 I removed the Recaps module from the sidekiq-cron initializer and let it fail on that. 我从sidekiq-cron初始化程序中删除了Recaps模块,并使其失败了。 Then I reintroduced the module name and with a few redis-cli flushall commands sprinkled and there, and everything seems to be working fine. 然后,我重新引入了模块名称,并在其中散布了一些redis-cli flushall命令,似乎一切正常。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM