简体   繁体   English

Sidekiq与发条触发但不处理heroku上的工作

[英]Sidekiq with Clockwork triggers but doesn't process job on heroku

Running: sidekiq 2.1.17, rails 3.2.21 运行:sidekiq 2.1.17,rails 3.2.21

I'm trying to use clockwork to schedule some recurring tasks to be done by sidekiq workers. 我正在尝试使用发条来安排一些由sidekiq工人完成的重复任务。 Running foreman in development, everything runs perfectly as scheduled. 在开发中运行领班,一切都按计划完美运行。

When I deploy to heroku, however, I get the "Triggering 'NameWorker.perform_async'" message in the logs at the appropriate times but then the respective jobs don't actually run. 但是,当我部署到heroku时,我会在适当的时间在日志中收到“触发'NameWorker.perform_async'”消息,但随后各个作业实际上并未运行。

When I instead call NameWorker.perform_async in a controller action, the job runs as it should. 当我在控制器操作中调用NameWorker.perform_async时,作业将按预期运行。 The jobs I'm trying to schedule just contain puts statements to verify that they're working. 我正在尝试安排的工作只包含put语句以验证它们是否正常工作。 Anyone have any ideas about what I'm doing wrong? 任何人对我做错了什么有任何想法? Thanks in advance. 提前致谢。

Solved by adding the Sidekiq.configure_client logic from the sidekiq.rb file into clock.rb. 通过将sidekiq.rb文件中的Sidekiq.configure_client逻辑添加到clock.rb中来解决此问题。 This logic was already there and in unicorn but sidekiq was not being initialized in production for the purposes of the clockwork process. 这个逻辑已经存在并且在独角兽中,但是为了发条过程的目的,sidekiq没有在生产中初始化。

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

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