Ice cube, how to set a rule of every day at a certain time for Sidetiq/Fist of Fury

561 Views Asked by At

Per docs I thought it would be (for everyday at 3pm)

daily.hour_of_day(15)

What I'm getting is a random mess. First, it's executing whenever I push to Heroku regardless of time, and then beyond that, seemingly randomly. So the latest push to Heroku was 1:30pm. It executed: twice at 1:30pm, once at 2pm, once at 4pm, once at 5pm.

Thoughts on what's wrong?

Full code (note this is for the Fist of Fury gem, but FoF is heavily influenced by Sidetiq so help from Sidetiq users would be great as well).

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

end

1

There are 1 best solutions below

0
Groove On

Maybe you should use:

  recurrence { daily.hour_of_day(15) }

instead of recurs?