我有员工向服务器发送请求并检查exist文件。现在,员工在指定的时间运行:
CheckFileWorker.perform_in(@target_file.check_start_date, @target_file.url)
发布于 2014-08-21 12:16:29
我使用Sidetiq来调度周期性后台作业(https://github.com/tobiassvn/sidetiq)。
基本上,您应该做类似的事情:
class LicenseCheckerWorker
include Sidekiq::Worker
include Sidetiq::Schedulable
recurrence { hourly }
def perform
#your logic here
end
end
当然,您应该更改重复调度以反映您的首选项。
编辑:另一种方法是安排另一次运行在#执行逻辑的末尾,延迟2秒。
https://stackoverflow.com/questions/25418911
复制相似问题