我使用的是Rails 5。 我不明白为什么我的Sidekiq worker在我的本地机器上调度时不运行。 我设置了这个configsidekiq.yml......。
---
:concurrency: 5
:verbose: true
:logfile: ./log/sidekiq.log
:queues:
- default
:schedule:
Accounting::Workers::AuditWorker:
cron: "35 15 * * *"
queue: default
我开始运行
bundle exec sidekiq -C ./config/sidekiq.yml
但在指定的时间(下午3:35),什么都没有发生。 当我把表达式改为
cron: "35 * * * *"
然后,我看到我的工人在35点整的时候有输出。 工作器看起来像...
require 'sidekiq/api'
module Accounting::Workers
class AuditWorker
include Sidekiq::Worker
def perform
print "Beginning service #{Time.now}...\n"
...
end
我还需要做什么才能让事情在我指定的时间运行?
试试这个方法
cron: '35 20 * * *'
对我来说,把它放在工作 世界协调时