Search code examples
rubyscheduled-tasksschedulingsidekiqworker

Calling/scheduling sidekiq worker from them selves


Is there any other way to reschedule sidekiq worker than calling perform_in or perform_at from their own perform method?

Is this viable?

class TestWorker
  include Sidekiq::Worker
  sidekiq_options retry: false


  def perform
    if something
      TestWorker.perform_in(14.days)
    end
  end

end

Solution

  • Yes, it's perfectly normal to reschedule a job from itself.