根据文档,我认为应该是(每天下午3点)
daily.hour_of_day(15)我得到的是一个随机的混乱。首先,无论时间长短,只要我推送到Heroku,它就会执行,然后,似乎是随机执行的。所以去Heroku的最新推送时间是下午1:30执行:下午1:30执行两次,下午2:00执行一次,下午4:00执行一次,下午5:00执行一次。
对哪里出问题有什么想法?
完整的代码(注意这是Fury gem的拳头,但FoF受Sidetiq的影响很大,所以Sidetiq用户的帮助也会很好)。
class Outstanding
include SuckerPunch::Job
include FistOfFury::Recurrent
recurs { daily.hour_of_day(15) }
def perform
ActiveRecord::Base.connection_pool.with_connection do
# Auto email lenders every other day if they have outstanding requests
lender_array = Array.new
Inventory.where(id: (Borrow.where(status1:1).all.pluck("inventory_id"))).each { |i| lender_array << i.signup.id }
lender_array.uniq!
lender_array.each { |l| InventoryMailer.outstanding_request(l).deliver }
end
end结束
发布于 2015-06-11 22:52:55
也许你应该使用:
recurrence { daily.hour_of_day(15) }而不是循环?
https://stackoverflow.com/questions/25071032
复制相似问题