I have implemented scheduled notifications using Sidekiq. I want to also add an ability of rescheduling jobs that haven't been run yet. I do see a reschedule method in the sidekiq api code https://github.com/mperham/sidekiq/blob/061068c551bd96eb6aa790dda0a4dad85bf55381/lib/sidekiq/api.rb but I am not sure what to pass as the arguments when initializing the SortedEntry class. There are no examples in the documentation so I was wondering if anybody has any experience with Sidekiq rescheduling? By the way I grab the jid when I create a job:
message_jid = MessagesWorker.perform_in(@message.deliver_at, msgs2_ids, @message.id)
According to this Sidekiq documentation page to delete a job with a single id you need to iterate the queue and call . delete on it.
Today Sidekiq uses a default concurrency of 25. These means Sidekiq will spawn 25 worker threads and execute up to 25 jobs concurrently in a process.
To run sidekiq, you will need to open a terminal, navigate to your application's directory, and start the sidekiq process, exactly as you would start a web server for the application itself. When the command executes you will see a message that sidekiq has started.
You do this:
Sidekiq::ScheduledSet.new.find_job(@message.jid).reschedule(1.day.from_now)
The find_job
call is very slow and will not scale to lots of jobs in the scheduled set. I recommend you either:
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With