Reputation: 29
I have worker that send request to server and checks exist file. Now worker runs at the specified time:
CheckFileWorker.perform_in(@target_file.check_start_date, @target_file.url)
Upvotes: 1
Views: 1276
Reputation: 3641
I'm using Sidetiq for scheduling recurring background jobs (https://github.com/tobiassvn/sidetiq).
Basically you should do something similar to this:
class LicenseCheckerWorker
include Sidekiq::Worker
include Sidetiq::Schedulable
recurrence { hourly }
def perform
#your logic here
end
end
Of course you should change the recurrence schedule to reflect your preferences.
Edit: another way to do this is schedule another run at the end of the #perform logic, delayed by 2 seconds.
Upvotes: 1