ドキュメントごとに、そうなると思いました(毎日午後3時)
daily.hour_of_day(15)
私が得ているのはランダムな混乱です。まず、時間に関係なく Heroku にプッシュするたびに実行され、それ以降は一見ランダムに実行されます。したがって、Heroku への最新のプッシュは午後 1 時 30 分でした。実行: 午後 1 時 30 分に 2 回、午後 2 時に 1 回、午後 4 時に 1 回、午後 5 時に 1 回。
何が悪いのか考えていますか?
完全なコード (これは Fist of 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
終わり