I am working on implementing a requirement for a web app:
- Users should be able to schedule a job in the future
- Users should be able to view a list of scheduled jobs
- Users should be able to edit the time of scheduled jobs
All of the above can easily be done with Sidekiq using something like:
ss = Sidekiq::ScheduledSet.new
job = ss.find_job(jid)
job.reschedule(at)
However, I would have to store in the db at least the jid and the scheduled time so that the user can determine if he / she wants to reschedule it.
My concern is that the above is not efficient. First, I would have to duplicate storage in redis and the db, additionally, as Mike Perham put it:
You can do this but it won't be efficient. It's a linear scan for find a scheduled job by JID.
See https://stackoverflow.com/a/24189112/1755697
If I need to store details in the db and in redis (sidekiq storage), I am wondering if it may be simpler to go with Delayed Job which stores job in the db, thus not duplicating storage.
The main concern about Delayed Job is that it is not yet Rails 5.0 ready and it has not been updated for a while.
I would appreciate any suggestion on which system to chose or how to use Sidekiq in a more efficient way to meet the above mentioned requirements.